diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index bed8a1ba..d97deb03 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -497,6 +497,7 @@ 23FF42792AA6E19C0055733C /* HomeMenuSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */; }; 23FF428E2AAB2D3A0055733C /* XPCandyTreeBuyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */; }; 4C1892992CF84349004D4426 /* RoomCahtCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1892982CF84349004D4426 /* RoomCahtCell.m */; }; + 4C5C37232D0C1C7900BA9AB8 /* RegionListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C5C37222D0C1C7900BA9AB8 /* RegionListViewController.m */; }; 4C6E1F752CEAEC3C0073D0A3 /* ShoppingMallTagView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6E1F742CEAEC3C0073D0A3 /* ShoppingMallTagView.m */; }; 4C6E1F792CEB12780073D0A3 /* UIView+GradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6E1F782CEB12780073D0A3 /* UIView+GradientLayer.m */; }; 4C6E1F7C2CEB25B10073D0A3 /* ShoppingMallItemPreview.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6E1F7B2CEB25B10073D0A3 /* ShoppingMallItemPreview.m */; }; @@ -505,6 +506,11 @@ 4C815A172CFEB758002A46A6 /* SuperBlockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C815A162CFEB758002A46A6 /* SuperBlockViewController.m */; }; 4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; }; 4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; }; + 4CEB9EA72D09643E00443480 /* UserRoomCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */; }; + 4CEB9EAA2D097E8400443480 /* MoliAvatar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA92D097E8400443480 /* MoliAvatar.m */; }; + 4CEB9EAD2D09AA0400443480 /* SexAgeLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */; }; + 4CEB9EB02D0AF4FE00443480 /* TwentyMicStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EAF2D0AF4FE00443480 /* TwentyMicStageView.m */; }; + 4CEB9EB32D0AFCE200443480 /* NineteenMicStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EB22D0AFCE200443480 /* NineteenMicStageView.m */; }; 540EC1D02C89925F00F3BF0D /* GiftComboView.m in Sources */ = {isa = PBXBuildFile; fileRef = 540EC1CF2C89925F00F3BF0D /* GiftComboView.m */; }; 540EC1D32C89998500F3BF0D /* GiftComboManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 540EC1D22C89998500F3BF0D /* GiftComboManager.m */; }; 5412E0F42C4E460300FDD668 /* XPMineCenterAgencyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 5412E0F32C4E460300FDD668 /* XPMineCenterAgencyView.m */; }; @@ -2584,6 +2590,8 @@ 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeBuyView.m; sourceTree = ""; }; 4C1892972CF84349004D4426 /* RoomCahtCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomCahtCell.h; sourceTree = ""; }; 4C1892982CF84349004D4426 /* RoomCahtCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomCahtCell.m; sourceTree = ""; }; + 4C5C37212D0C1C7900BA9AB8 /* RegionListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RegionListViewController.h; sourceTree = ""; }; + 4C5C37222D0C1C7900BA9AB8 /* RegionListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RegionListViewController.m; sourceTree = ""; }; 4C6E1F732CEAEC3C0073D0A3 /* ShoppingMallTagView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ShoppingMallTagView.h; sourceTree = ""; }; 4C6E1F742CEAEC3C0073D0A3 /* ShoppingMallTagView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ShoppingMallTagView.m; sourceTree = ""; }; 4C6E1F772CEB12780073D0A3 /* UIView+GradientLayer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIView+GradientLayer.h"; sourceTree = ""; }; @@ -2600,6 +2608,16 @@ 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataPresent.m; sourceTree = ""; }; 4CC6195B2CEC996E008C1EE8 /* MyDressingDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataModel.h; sourceTree = ""; }; 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataModel.m; sourceTree = ""; }; + 4CEB9EA52D09643E00443480 /* UserRoomCardViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomCardViewController.h; sourceTree = ""; }; + 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserRoomCardViewController.m; sourceTree = ""; }; + 4CEB9EA82D097E8400443480 /* MoliAvatar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoliAvatar.h; sourceTree = ""; }; + 4CEB9EA92D097E8400443480 /* MoliAvatar.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MoliAvatar.m; sourceTree = ""; }; + 4CEB9EAB2D09AA0400443480 /* SexAgeLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SexAgeLabel.h; sourceTree = ""; }; + 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SexAgeLabel.m; sourceTree = ""; }; + 4CEB9EAE2D0AF4FE00443480 /* TwentyMicStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TwentyMicStageView.h; sourceTree = ""; }; + 4CEB9EAF2D0AF4FE00443480 /* TwentyMicStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TwentyMicStageView.m; sourceTree = ""; }; + 4CEB9EB12D0AFCE200443480 /* NineteenMicStageView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NineteenMicStageView.h; sourceTree = ""; }; + 4CEB9EB22D0AFCE200443480 /* NineteenMicStageView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NineteenMicStageView.m; sourceTree = ""; }; 540EC1CE2C89925F00F3BF0D /* GiftComboView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftComboView.h; sourceTree = ""; }; 540EC1CF2C89925F00F3BF0D /* GiftComboView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftComboView.m; sourceTree = ""; }; 540EC1D12C89998500F3BF0D /* GiftComboManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftComboManager.h; sourceTree = ""; }; @@ -5197,6 +5215,10 @@ 189DD68226E1FDBB00AB55B1 /* XNDJTDDLoadingTool.m */, E8B825CB26EA18C8009E8E9F /* DJDKMIMOMColor.h */, E8B825CC26EA18C8009E8E9F /* DJDKMIMOMColor.m */, + 4CEB9EA82D097E8400443480 /* MoliAvatar.h */, + 4CEB9EA92D097E8400443480 /* MoliAvatar.m */, + 4CEB9EAB2D09AA0400443480 /* SexAgeLabel.h */, + 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */, ); path = CustomUI; sourceTree = ""; @@ -5221,6 +5243,8 @@ E824543426F57D6E00BE8163 /* XPLoginVerifBindPhoneViewController.m */, 23B2AEC32A6516C200543D17 /* LoginForgetPasswordViewController.h */, 23B2AEC22A6516C200543D17 /* LoginForgetPasswordViewController.m */, + 4C5C37212D0C1C7900BA9AB8 /* RegionListViewController.h */, + 4C5C37222D0C1C7900BA9AB8 /* RegionListViewController.m */, ); path = View; sourceTree = ""; @@ -8167,6 +8191,8 @@ E82325FD274E48D0003A3332 /* Cell */, E82325F0274E2DE6003A3332 /* XPUserCardViewController.h */, E82325F1274E2DE6003A3332 /* XPUserCardViewController.m */, + 4CEB9EA52D09643E00443480 /* UserRoomCardViewController.h */, + 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */, ); path = View; sourceTree = ""; @@ -10599,6 +10625,10 @@ 236B2E512AA08756003967A8 /* LittleGameScrollStageView.m */, 236B2E522AA08757003967A8 /* LittleGameStageView.h */, 236B2E502AA08756003967A8 /* LittleGameStageView.m */, + 4CEB9EAE2D0AF4FE00443480 /* TwentyMicStageView.h */, + 4CEB9EAF2D0AF4FE00443480 /* TwentyMicStageView.m */, + 4CEB9EB12D0AFCE200443480 /* NineteenMicStageView.h */, + 4CEB9EB22D0AFCE200443480 /* NineteenMicStageView.m */, ); path = StageView; sourceTree = ""; @@ -11883,6 +11913,7 @@ 23E9EAAE2A84C9B800B792F2 /* XPMineUserInfoTagView.m in Sources */, 236B2E4E2AA07D06003967A8 /* Api+LittleGame.m in Sources */, 237700E02BC7D78600D661F1 /* MSBaseRTLFlowLayout.m in Sources */, + 4CEB9EB32D0AFCE200443480 /* NineteenMicStageView.m in Sources */, 2331C1B32A60F32D00E1D940 /* XPCandyTreeMoreRuleCell.m in Sources */, 14A6034C29A35EE600D2A6A5 /* XPMineItemTableViewCell.m in Sources */, 9BAC92F528E6E63000147DD8 /* XPRoomInsideOperationCell.m in Sources */, @@ -12158,6 +12189,7 @@ E8B846CF26FDD96100A777FE /* XPMineRechageHeadView.m in Sources */, E852D74728633E92001465ED /* MonentsCommentReplyModel.m in Sources */, 186A534926FC6ED900D67B2C /* TTAlertMessageAttributedConfig.m in Sources */, + 4CEB9EB02D0AF4FE00443480 /* TwentyMicStageView.m in Sources */, E8B3E80C2848BA40009746AB /* NewUserGreetModel.m in Sources */, E85E7B4D2A4EB0D300B6D00A /* XPMineGuildRemoveMemberViewController.m in Sources */, 9BCB99A028F571B500466D64 /* XPMineCollectPartyRoomViewController.m in Sources */, @@ -12247,6 +12279,7 @@ 9B0E1C5926E77022005D4442 /* BaseNavigationController.m in Sources */, E8664ED927E4355C000171BA /* XPRoomPKRecordTableViewCell.m in Sources */, 238B37AB2AC55A2C00BFC9D5 /* TreasureFairyConvertRecordModel.m in Sources */, + 4CEB9EAD2D09AA0400443480 /* SexAgeLabel.m in Sources */, 23FF42762AA6E1480055733C /* XPHomeRecommendOtherRoomView.m in Sources */, 142721B229A7647F00C7C423 /* XPBlankViewController.m in Sources */, E85E7B6B2A4EC39400B6D00A /* XPMineExchangeAuthorityModel.m in Sources */, @@ -12282,6 +12315,7 @@ E8EEB91726FC7B35007C6EBA /* XPMineUserInfoDesViewController.m in Sources */, 544A36352C94160F00CA7858 /* RoomMenuBar.m in Sources */, 9B1B72AC280031DB003FACE9 /* XPAnchorPKViewController.m in Sources */, + 4CEB9EA72D09643E00443480 /* UserRoomCardViewController.m in Sources */, 237852A12C072D8D00E360AC /* MSRoomGameModel.m in Sources */, 180806FB2729A354001FD836 /* ThemeColor+Room.m in Sources */, 9BC8C83028090C9200C24F85 /* XPRoomAnchorRankBannerView.m in Sources */, @@ -12448,6 +12482,7 @@ 9B734F76288A92FB00CBDAA9 /* XPMineFunctionItemModel.m in Sources */, 541DD9552C1EDEFB00B616C4 /* XPHomePagingViewController.m in Sources */, E82D5C70276AE60000858D6D /* HeadwearModel.m in Sources */, + 4C5C37232D0C1C7900BA9AB8 /* RegionListViewController.m in Sources */, 238B37CC2AC55A2C00BFC9D5 /* XPTreasureFairyPrizeSubView.m in Sources */, E81125C4296E57B7000D9804 /* QinputPhotoView.m in Sources */, E880B3A1278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m in Sources */, @@ -12554,6 +12589,7 @@ 23FF25792ABD67CD0064E904 /* XPFreeGiftModel.m in Sources */, 9B92A33C2797E38100AD168F /* XPMineHeadItemTableViewCell.m in Sources */, E854103928646A00005CFD9F /* XPMonentsReplyMoreTableViewCell.m in Sources */, + 4CEB9EAA2D097E8400443480 /* MoliAvatar.m in Sources */, 9B8DE0E1289CF02900FB6EC2 /* XPGiftCompoundModel.m in Sources */, 23FF256E2ABC48810064E904 /* XPSessionMainViewController.m in Sources */, E85E7B092A4EB0D200B6D00A /* XPGuildRemoveMemberPresenter.m in Sources */, diff --git a/YuMi/Assets.xcassets/1.0.31/Contents.json b/YuMi/Assets.xcassets/1.0.31/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/3@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/3@3x.png new file mode 100644 index 00000000..c2bba3dd Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/3@3x.png differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/Contents.json similarity index 85% rename from YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/Contents.json rename to YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/Contents.json index 23d8051d..fa52775a 100644 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/Contents.json +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_at.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "user_card_open_mic.png", "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +9,7 @@ "scale" : "2x" }, { + "filename" : "3@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/2@3x (1).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/2@3x (1).png new file mode 100644 index 00000000..d57a6991 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/2@3x (1).png differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/Contents.json similarity index 85% rename from YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/Contents.json rename to YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/Contents.json index c30d2fb2..3df53e45 100644 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/Contents.json +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_be_manager.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "user_card_lock_mic.png", "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +9,7 @@ "scale" : "2x" }, { + "filename" : "2@3x (1).png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/3@3x (1).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/3@3x (1).png new file mode 100644 index 00000000..b38aae68 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/3@3x (1).png differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/Contents.json similarity index 85% rename from YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/Contents.json rename to YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/Contents.json index 612e69c8..3aacb355 100644 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/Contents.json +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_blacklist.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "user_card_close_mic.png", "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +9,7 @@ "scale" : "2x" }, { + "filename" : "3@3x (1).png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/2@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/2@3x.png new file mode 100644 index 00000000..3f1bb79f Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/2@3x.png differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/Contents.json similarity index 84% rename from YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/Contents.json rename to YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/Contents.json index e336b512..25f1bb8c 100644 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/Contents.json +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_chat.imageset/Contents.json @@ -1,7 +1,6 @@ { "images" : [ { - "filename" : "user_card_no_lock_mic.png", "idiom" : "universal", "scale" : "1x" }, @@ -10,6 +9,7 @@ "scale" : "2x" }, { + "filename" : "2@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/2@3x (3).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/2@3x (3).png new file mode 100644 index 00000000..85c39959 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/2@3x (3).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/Contents.json new file mode 100644 index 00000000..f903d291 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_clean_gift_value.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "2@3x (3).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/5@3x (3).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/5@3x (3).png new file mode 100644 index 00000000..aa83e22f Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/5@3x (3).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/Contents.json new file mode 100644 index 00000000..f5b6975c --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_close_mic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5@3x (3).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/4@3x (1).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/4@3x (1).png new file mode 100644 index 00000000..694232a3 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/4@3x (1).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/Contents.json new file mode 100644 index 00000000..18e8c28b --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_follow.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "4@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/2@3x (2).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/2@3x (2).png new file mode 100644 index 00000000..28d682ed Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/2@3x (2).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/Contents.json new file mode 100644 index 00000000..ba886bdc --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_gift.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "2@3x (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/1@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/1@3x.png new file mode 100644 index 00000000..ecf8f221 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/1@3x.png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/Contents.json new file mode 100644 index 00000000..6e1d814b --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_kick.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "1@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/1@3x (1).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/1@3x (1).png new file mode 100644 index 00000000..7ba302e2 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/1@3x (1).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/Contents.json new file mode 100644 index 00000000..89d6af5f --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_lock.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "1@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/5@3x (2).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/5@3x (2).png new file mode 100644 index 00000000..25053baa Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/5@3x (2).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/Contents.json new file mode 100644 index 00000000..b4323a19 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_not_manager.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5@3x (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/4@3x (2).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/4@3x (2).png new file mode 100644 index 00000000..19ac0836 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/4@3x (2).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/Contents.json new file mode 100644 index 00000000..903ed6a3 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_open_mic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "4@3x (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/5@3x (1).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/5@3x (1).png new file mode 100644 index 00000000..03fa8afc Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/5@3x (1).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/Contents.json new file mode 100644 index 00000000..b972d331 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_out_mic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/Contents.json new file mode 100644 index 00000000..3ad6e843 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "举报@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/举报@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/举报@3x.png new file mode 100644 index 00000000..40109668 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_report.imageset/举报@3x.png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/1@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/1@3x.png new file mode 100644 index 00000000..e0d1df0a Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/1@3x.png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/Contents.json new file mode 100644 index 00000000..6e1d814b --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_send_gift.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "1@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/4@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/4@3x.png new file mode 100644 index 00000000..ddf08121 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/4@3x.png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/Contents.json new file mode 100644 index 00000000..ed396281 --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_unfollow.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "4@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/1@3x (2).png b/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/1@3x (2).png new file mode 100644 index 00000000..27295781 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/1@3x (2).png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/Contents.json new file mode 100644 index 00000000..8f10bc0c --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_unlock.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "1@3x (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/5@3x.png b/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/5@3x.png new file mode 100644 index 00000000..f63d9c36 Binary files /dev/null and b/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/5@3x.png differ diff --git a/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/Contents.json b/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/Contents.json new file mode 100644 index 00000000..21354d0c --- /dev/null +++ b/YuMi/Assets.xcassets/1.0.31/room_user_card_up_mic.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/Contents.json b/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/Contents.json deleted file mode 100644 index 4a0250c5..00000000 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "user_card_clean_gift_value.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/user_card_clean_gift_value.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/user_card_clean_gift_value.png deleted file mode 100644 index b57b3300..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_clean_gift_value.imageset/user_card_clean_gift_value.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/user_card_close_mic.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/user_card_close_mic.png deleted file mode 100644 index 833b1110..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_close_mic.imageset/user_card_close_mic.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/Contents.json b/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/Contents.json deleted file mode 100644 index 11fe6273..00000000 --- a/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "filename" : "user_card_down_mic_listen.png", - "idiom" : "universal", - "scale" : "1x" - }, - { - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/user_card_down_mic_listen.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/user_card_down_mic_listen.png deleted file mode 100644 index ef7a2ef5..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_down_mic_listen.imageset/user_card_down_mic_listen.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/user_card_lock_mic.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/user_card_lock_mic.png deleted file mode 100644 index 44fdc68d..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_lock_mic.imageset/user_card_lock_mic.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/user_card_no_lock_mic.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/user_card_no_lock_mic.png deleted file mode 100644 index 4963360b..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_no_lock_mic.imageset/user_card_no_lock_mic.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/user_card_open_mic.png b/YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/user_card_open_mic.png deleted file mode 100644 index 69cef426..00000000 Binary files a/YuMi/Assets.xcassets/yna/UserCard/user_card_open_mic.imageset/user_card_open_mic.png and /dev/null differ diff --git a/YuMi/CustomUI/MoliAvatar.h b/YuMi/CustomUI/MoliAvatar.h new file mode 100644 index 00000000..68ace682 --- /dev/null +++ b/YuMi/CustomUI/MoliAvatar.h @@ -0,0 +1,22 @@ +// +// MoliAvatar.h +// YuMi +// +// Created by P on 2024/12/11. +// + +#import + +@class UserInfoModel; + +NS_ASSUME_NONNULL_BEGIN + +@interface MoliAvatar : UIView + +@property(nonatomic, strong) UserInfoModel *userInfo; + +@property(nonatomic, copy) void(^handleTapAvatar)(void); + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/CustomUI/MoliAvatar.m b/YuMi/CustomUI/MoliAvatar.m new file mode 100644 index 00000000..7d995c5c --- /dev/null +++ b/YuMi/CustomUI/MoliAvatar.m @@ -0,0 +1,153 @@ +// +// MoliAvatar.m +// YuMi +// +// Created by P on 2024/12/11. +// + +#import "MoliAvatar.h" + +#import "UserInfoModel.h" + +#import +#import + +#import "UIView+VAP.h" +#import "SpriteSheetImageManager.h" + +@interface MoliAvatar () + +@property (nonatomic,strong) NetImageView *avatarView; + +///序列帧 +@property (nonatomic, strong) SpriteSheetImageManager *sequenceFrameManager; +@property (nonatomic,strong) YYAnimatedImageView *sequenceFrameHeadWear; + +///SVGA +@property (nonatomic, strong) SVGAImageView *headWearSvgaImageView; + +@end + +@implementation MoliAvatar + +- (void)dealloc +{ + if (_headWearSvgaImageView) { + [_headWearSvgaImageView stopAnimation]; + } +} + +- (instancetype)init { + if (self = [super init]) { + [self addSubview:self.avatarView]; + [self.avatarView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + } + return self; +} + +- (void)layoutSubviews { + [super layoutSubviews]; + + [self.avatarView setCornerRadius:self.frame.size.height / 2]; +} + +- (void)setUserInfo:(UserInfoModel *)userInfo { + _userInfo = userInfo; + + self.avatarView.imageUrl = userInfo.avatar; + + NSString *headerUrl = self.userInfo.headwearEffect.length > 0 ? self.userInfo.headwearEffect : self.userInfo.headwearPic; + if ([NSString isEmpty:headerUrl]) { + return; + } + + if ([userInfo isHeadWearSVGA]) { + [self setupAndPlaySVGA: headerUrl]; + } else { + [self setupAndPlayAnimate: headerUrl]; + } +} + +- (void)setupAndPlaySVGA:(NSString *)url { + [self addSubview:self.headWearSvgaImageView]; + [self.headWearSvgaImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.avatarView); + make.size.mas_equalTo(self.avatarView).multipliedBy(1.3); + }]; + + [self.headWearSvgaImageView setImageName:url]; +} + +- (void)setupAndPlayAnimate:(NSString *)url { + [self addSubview:self.sequenceFrameHeadWear]; + [self.sequenceFrameHeadWear mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.avatarView); + make.size.mas_equalTo(self.avatarView).multipliedBy(1.3); + }]; + + @kWeakify(self); + [self.sequenceFrameManager loadSpriteSheetImageWithURL:[NSURL URLWithString:url] + completionBlock:^(YYSpriteSheetImage * _Nullable sprit) { + @kStrongify(self); + self.sequenceFrameHeadWear.image = sprit; + } failureBlock:^(NSError * _Nullable error) {}]; +} + +#pragma mark - +- (void)clickAvatarAction { + if (self.handleTapAvatar) { + self.handleTapAvatar(); + } +} + +#pragma mark - + + +#pragma mark - +-(NetImageView *)avatarView{ + if (!_avatarView){ + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserIcon; + _avatarView = [[NetImageView alloc]initWithConfig:config]; + _avatarView.layer.cornerRadius = kGetScaleWidth(41); + _avatarView.layer.masksToBounds = YES; + _avatarView.layer.borderWidth = 1; + _avatarView.userInteractionEnabled = YES; + _avatarView.layer.borderColor = [UIColor whiteColor].CGColor; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(clickAvatarAction)]; + [_avatarView addGestureRecognizer:tap]; + } + return _avatarView; +} + +- (SVGAImageView *)headWearSvgaImageView { + if (!_headWearSvgaImageView) { + _headWearSvgaImageView = [[SVGAImageView alloc]init]; + _headWearSvgaImageView.backgroundColor = [UIColor clearColor]; + _headWearSvgaImageView.frame = self.bounds; + _headWearSvgaImageView.userInteractionEnabled = YES; + _headWearSvgaImageView.autoPlay = YES; + } + return _headWearSvgaImageView; +} + +- (YYAnimatedImageView *)sequenceFrameHeadWear { + if (!_sequenceFrameHeadWear) { + _sequenceFrameHeadWear = [[YYAnimatedImageView alloc] init]; + _sequenceFrameHeadWear.backgroundColor = [UIColor clearColor]; + _sequenceFrameHeadWear.contentMode = UIViewContentModeScaleAspectFit; + } + return _sequenceFrameHeadWear; +} + +- (SpriteSheetImageManager *)sequenceFrameManager { + if (!_sequenceFrameManager) { + _sequenceFrameManager = [[SpriteSheetImageManager alloc] init]; + } + return _sequenceFrameManager; +} + +@end diff --git a/YuMi/CustomUI/SexAgeLabel.h b/YuMi/CustomUI/SexAgeLabel.h new file mode 100644 index 00000000..7c674fa7 --- /dev/null +++ b/YuMi/CustomUI/SexAgeLabel.h @@ -0,0 +1,18 @@ +// +// SexAgeLabel.h +// YuMi +// +// Created by P on 2024/12/11. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface SexAgeLabel : UIView + +- (void)updateSex:(BOOL)isMale age:(NSInteger)age; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/CustomUI/SexAgeLabel.m b/YuMi/CustomUI/SexAgeLabel.m new file mode 100644 index 00000000..b0fa42de --- /dev/null +++ b/YuMi/CustomUI/SexAgeLabel.m @@ -0,0 +1,65 @@ +// +// SexAgeLabel.m +// YuMi +// +// Created by P on 2024/12/11. +// + +#import "SexAgeLabel.h" + +@interface SexAgeLabel () + +@property(nonatomic, strong) UIView *pillBackground; +@property(nonatomic, strong) UIImageView *sexImageView; +@property(nonatomic, strong) UILabel *ageLabel; + +@end + +@implementation SexAgeLabel + +- (instancetype)init { + if (self = [super init]) { + +// self.frame = CGRectMake(0, 0, 35, 16); + + [self setCornerRadius:8]; + [self addGradientBackgroundWithColors:@[[UIColor redColor], [UIColor blueColor]] startPoint:CGPointMake(0.5, 0) endPoint:CGPointMake(0.5, 1) cornerRadius:8]; + + [self addSubview:self.sexImageView]; + [self addSubview:self.ageLabel]; + [self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self); + make.leading.mas_equalTo(2); + make.width.height.mas_equalTo(8); + }]; + + [self.ageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self); + make.leading.mas_equalTo(self.sexImageView.mas_trailing).offset(2); + make.trailing.mas_equalTo(-2); + }]; + } + return self; +} + +- (void)updateSex:(BOOL)isMale age:(NSInteger)age { + self.sexImageView.image = isMale ? kImage(@"session_user_sex_male") : kImage(@"session_user_sex_female"); + self.ageLabel.text = @(age).stringValue; +} + +- (UIImageView *)sexImageView { + if (!_sexImageView) { + _sexImageView = [[UIImageView alloc] init]; + _sexImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _sexImageView; +} + +- (UILabel *)ageLabel { + if (!_ageLabel) { + _ageLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(12) textColor:[UIColor whiteColor]]; + } + return _ageLabel; +} + +@end diff --git a/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m b/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m index f3ae9645..711a064e 100644 --- a/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m +++ b/YuMi/Modules/YMLogin/View/LoginFullInfoViewController.m @@ -26,7 +26,9 @@ #import "PILoginManager.h" #import "ClientConfig.h" -@interface LoginFullInfoViewController () +#import "RegionListViewController.h" + +@interface LoginFullInfoViewController () ///背景 @property(nonatomic,strong) UIImageView *bgImageView; @@ -61,11 +63,16 @@ ///邀请码输入框 @property (nonatomic,strong) MSBaseTextField *codeTextField; +@property (nonatomic,strong) UIView *regionContainView; +@property(nonatomic, strong) UILabel *regionLabel; +@property(nonatomic, strong) NetImageView *regionFlagImageView; + ///第三方的用户信息 @property (nonatomic,strong) ThirdUserInfo *thirdInfo; ///目前选择的性别 @property (nonatomic,copy) NSString *sexString; + @end @implementation LoginFullInfoViewController @@ -107,6 +114,7 @@ [self.bgView addSubview:self.backView]; [self.view addSubview:self.codeContainView]; + [self.view addSubview:self.regionContainView]; [self.view addSubview:self.nextButton]; [self.view addSubview:self.block18Tips]; @@ -118,6 +126,16 @@ [self.sexStackView addArrangedSubview:self.femaleView]; [self.codeContainView addSubview:self.codeTextField]; + + UIStackView *regionStack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.regionFlagImageView, + self.regionLabel + ]]; + [self.regionContainView addSubview:regionStack]; + [regionStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(kGetScaleWidth(24)); + make.centerY.mas_equalTo(self.regionContainView); + }]; if ([self.presenter getThirdUserInfo] && [self.presenter getThirdUserInfo].userName.length > 0) { self.textField.text = [self.presenter getThirdUserInfo].userName; @@ -146,7 +164,6 @@ [self.remindLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.equalTo(self.bgView).inset(kGetScaleWidth(10)); make.top.mas_equalTo(kGetScaleWidth(48)); - }]; [self.sexStackView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -196,12 +213,17 @@ make.top.bottom.mas_equalTo(self.codeContainView); make.trailing.mas_equalTo(self.codeContainView).offset(-kGetScaleWidth(18)); }]; + + [self.regionContainView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.height.mas_equalTo(self.backView); + make.top.mas_equalTo(self.codeContainView.mas_bottom).offset(kGetScaleWidth(20)); + }]; [self.nextButton mas_makeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(kGetScaleWidth(303)); make.centerX.equalTo(self.bgView); make.height.mas_equalTo(kGetScaleWidth(48)); - make.top.mas_equalTo(self.codeContainView.mas_bottom).offset(kGetScaleWidth(48)); + make.top.mas_equalTo(self.regionContainView.mas_bottom).offset(kGetScaleWidth(38)); }]; [self.block18Tips mas_makeConstraints:^(MASConstraintMaker *make) { @@ -228,6 +250,20 @@ _inviteCode = inviteCode; self.codeTextField.text = _inviteCode; } + +- (void)didTapRegionButton { + // TODO: display list + RegionListViewController *vc = [[RegionListViewController alloc] initForHomeTags]; + +// vc.modalPresentationStyle = UIModalPresentationPageSheet; // 可结合 UIModalPresentationCustom +// vc.preferredContentSize = CGSizeMake(self.view.bounds.size.width, 100); // 设置高度为 300 + +// vc.modalPresentationStyle = UIModalPresentationCustom; +// vc.transitioningDelegate = self; // 设置自定义的过渡代理 +// [self.navigationController pushViewController:vc animated:YES]; + [self presentViewController:vc animated:YES completion:nil]; +} + ///更新用户信息 - (void)updateUserInfo { [XNDJTDDLoadingTool showOnlyView:self.view]; @@ -253,6 +289,27 @@ } } +#pragma mark - UIViewControllerTransitioningDelegate +// +//- (UIPresentationController *)presentationControllerForPresentedViewController:(UIViewController *)presented +// presentingViewController:(UIViewController *)presenting +// sourceViewController:(UIViewController *)source { +// CustomPresentationController *customPresentationController = +// [[CustomPresentationController alloc] initWithPresentedViewController:presented +// presentingViewController:presenting]; +// customPresentationController.preferredHeight = 400; // 設置想要的高度 +// return customPresentationController; +//} +// +//- (CGSize)sizeForChildContentContainer:(id)container withParentContainerSize:(CGSize)parentSize { +// return CGSizeMake(parentSize.width, 300); // 设置高度为 300 +//} +// +//- (CGRect)frameOfPresentedViewInContainerView { +// CGRect containerBounds = self.presentingViewController.view.bounds; +// return CGRectMake(0, containerBounds.size.height - 300, containerBounds.size.width, 300); // 从底部呈现,高度为 300 +//} + #pragma mark - LoginFullInfoProtocol - (void)requestRandomNickSuccess:(NSString *)nick { self.textField.text = nick; @@ -494,4 +551,45 @@ } return _bgView; } + +- (UIView *)regionContainView { + if (!_regionContainView) { + _regionContainView = [[UIView alloc] init]; + _regionContainView.backgroundColor = UIColorFromRGB(0xF5F6FA); + [_regionContainView setCornerRadius:kGetScaleWidth(52)/2]; + + UIImageView *arrow = [[UIImageView alloc] initWithImage:kImage(@"room_setting_arrow")]; + arrow.contentMode = UIViewContentModeScaleAspectFit; + [_regionContainView addSubview:arrow]; + [arrow mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(_regionContainView); + make.trailing.mas_equalTo(-20); + make.width.height.mas_equalTo(20); + }]; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapRegionButton)]; + [_regionContainView addGestureRecognizer:tap]; + } + return _regionContainView; +} + +- (UILabel *)regionLabel { + if (!_regionLabel) { + _regionLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.31_text_0") + font:kFontMedium(12) + textColor:UIColorFromRGB(0xb3b3c1)]; + _regionLabel.userInteractionEnabled = YES; + } + return _regionLabel; +} + +- (NetImageView *)regionFlagImageView { + if (!_regionFlagImageView) { + _regionFlagImageView = [[NetImageView alloc] init]; + _regionFlagImageView.contentMode = UIViewContentModeScaleAspectFit; + _regionFlagImageView.userInteractionEnabled = YES; + } + return _regionFlagImageView; +} + @end diff --git a/YuMi/Modules/YMLogin/View/RegionListViewController.h b/YuMi/Modules/YMLogin/View/RegionListViewController.h new file mode 100644 index 00000000..f268b217 --- /dev/null +++ b/YuMi/Modules/YMLogin/View/RegionListViewController.h @@ -0,0 +1,22 @@ +// +// RegionListViewController.h +// YuMi +// +// Created by P on 2024/12/13. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RegionListViewController : MvpViewController + +@property(nonatomic, copy) void(^handleDismiss)(void); +@property(nonatomic, copy) void(^handleTapComfirm)(id obj); + +- (instancetype)initForRegionList; +- (instancetype)initForHomeTags; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMLogin/View/RegionListViewController.m b/YuMi/Modules/YMLogin/View/RegionListViewController.m new file mode 100644 index 00000000..469bfa59 --- /dev/null +++ b/YuMi/Modules/YMLogin/View/RegionListViewController.m @@ -0,0 +1,324 @@ +// +// RegionListViewController.m +// YuMi +// +// Created by P on 2024/12/13. +// + +#import "RegionListViewController.h" + +@interface RegionListCell : UICollectionViewCell +@property(nonatomic, strong) UIStackView *contentStack; +@property(nonatomic, strong) NetImageView *flagImageView; +@property(nonatomic, strong) UILabel *titleLabel; + ++ (void)registerTo:(UICollectionView *)collectionView; ++ (RegionListCell *)cellFor:(UICollectionView *)collectionView indexPath:(NSIndexPath *)indexPath; + +@end + +@implementation RegionListCell ++ (void)registerTo:(UICollectionView *)collectionView { + [collectionView registerClass:[self class] forCellWithReuseIdentifier:NSStringFromClass([self class])]; +} + ++ (RegionListCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath { + RegionListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class]) + forIndexPath:indexPath]; + cell.backgroundColor = [UIColor colorWithRed:arc4random()%255/255.0 green:arc4random()%255/255.0 blue:arc4random()%255/255.0 alpha:1]; + return cell; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self.contentView addSubview:self.contentStack]; + [self.contentStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.contentView); + make.height.mas_equalTo(18); + }]; + + [self.flagImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(24, 18)); + }]; +#if DEBUG + self.flagImageView.imageUrl = @"https://cdn3.iconfinder.com/data/icons/142-mini-country-flags-16x16px/32/flag-usa2x.png"; + self.titleLabel.text = @"Make UAS great again!"; +#endif + } + return self; +} + +- (void)prepareForReuse { + [super prepareForReuse]; + self.flagImageView.image = nil; +} + +#pragma mark - +- (UIStackView *)contentStack { + if (!_contentStack) { + _contentStack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.flagImageView, + self.titleLabel + ]]; + _contentStack.axis = UILayoutConstraintAxisHorizontal; + _contentStack.distribution = UIStackViewDistributionEqualCentering; + _contentStack.alignment = UIStackViewAlignmentCenter; + } + return _contentStack; +} + +- (NetImageView *)flagImageView { + if (!_flagImageView) { + _flagImageView = [[NetImageView alloc] init]; + _flagImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _flagImageView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:@"" font:kFontMedium(13) textColor:UIColorFromRGB(0x313131)]; + } + return _titleLabel; +} + +@end + + +@interface RegionListViewController () + +@property(nonatomic, assign) NSInteger type; +@property(nonatomic, assign) CGFloat displayHeight; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UISearchBar *searchBar; +@property(nonatomic, strong) UICollectionView *collectionView; +@property(nonatomic, strong) UIButton *comfirmButton; +@property(nonatomic, strong) UIView *bgView; +@end + +@implementation RegionListViewController + +- (instancetype)initForRegionList { + if (self = [super init]) { + self.type = 1; + self.displayHeight = KScreenHeight; + } + return self; +} +- (instancetype)initForHomeTags{ + if (self = [super init]) { + self.type = 2; +// self.modalPresentationStyle = UIModalPresentationFullScreen; + self.displayHeight = KScreenHeight/2; + + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.title = YMLocalizedString(@"1.0.31_text_1"); + switch (self.type) { + case 1: + [self setupUIForFullDisplay]; + break; + case 2: + [self setupUIForHalfScreen]; + break; + + default: + break; + } +} + +- (void)setupUIForFullDisplay { + self.view.backgroundColor = [UIColor clearColor]; + + self.comfirmButton.frame = CGRectMake(0, 0, 48, 44); + UIBarButtonItem *rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.comfirmButton]; + self.navigationItem.rightBarButtonItem = rightBarButtonItem; + + [self.view addSubview:self.searchBar]; + [self.searchBar mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(KScreenHeight - self.displayHeight); + make.leading.trailing.mas_equalTo(self.view).inset(16); + make.height.mas_equalTo(34); + }]; + + [self.view addSubview:self.collectionView]; + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.searchBar.mas_bottom).offset(8); + make.bottom.leading.trailing.mas_equalTo(0); + }]; +} + +- (void)setupUIForHalfScreen { + self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapSpace)]; + [self.view addGestureRecognizer:tap]; + + [self.view addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(KScreenHeight - self.displayHeight); + make.centerX.mas_equalTo(self.view); + make.height.mas_equalTo(34); + }]; + + [self.view addSubview:self.comfirmButton]; + [self.comfirmButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.titleLabel); + make.trailing.mas_equalTo(-8); + }]; + + [self.view addSubview:self.collectionView]; + [self.collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(8); + make.bottom.leading.trailing.mas_equalTo(0); + }]; + + [self.view insertSubview:self.bgView belowSubview:self.titleLabel]; + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(KScreenHeight - self.displayHeight -40); + make.leading.bottom.trailing.mas_equalTo(self.view); + }]; +} + +- (void)didTapComfirm { + // TODO: call api or call handleTapComfirm + switch (self.type) { + case 1: + [self dismissViewControllerAnimated:YES completion:nil]; + break; + case 2:{ + [self dismissViewControllerAnimated:YES completion:^{ + if (self.handleTapComfirm) { + self.handleTapComfirm(@""); + } + }]; + } + break; + default: + break; + } +} + +- (void)didTapSpace { + @kWeakify(self); + [self dismissViewControllerAnimated:YES completion:^{ + @kStrongify(self); + if (self.handleDismiss) { + self.handleDismiss(); + } + }]; +} + + +#pragma mark - UISearchBarDelegate +// 当点击 "Search" 按钮时触发 +- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar { + [searchBar resignFirstResponder]; // 收起键盘 + NSLog(@"User searched for: %@", searchBar.text); + + // 触发 API 查询 +// [self fetchSearchResultsForQuery:searchBar.text]; +} + +#pragma mark - +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + // TODO: 使用 api 返回的數據 + return 100; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + RegionListCell *cell = [RegionListCell cellFor:collectionView indexPath:indexPath]; + + return cell; +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + +} + +#pragma mark - +- (UISearchBar *)searchBar { + if (!_searchBar) { + UIColor *bgColor = UIColorFromRGB(0xf4f4f4); + _searchBar = [[UISearchBar alloc] init]; + _searchBar.delegate = self; + _searchBar.placeholder = YMLocalizedString(@"XPHomeSearchNavView1"); + _searchBar.barTintColor = bgColor; + [_searchBar setCornerRadius:34/2]; + if (@available(iOS 13.0, *)) { + _searchBar.searchTextField.backgroundColor = bgColor; + } else { + UITextField *searchField = [self findTextFieldInSearchBar:_searchBar]; + if (searchField) { + searchField.backgroundColor = bgColor; + } + } + } + return _searchBar; +} + +- (UICollectionView *)collectionView { + if (!_collectionView) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(KScreenWidth - 32, 48); + layout.sectionInset = UIEdgeInsetsMake(0, 16, kSafeAreaBottomHeight, 16); + layout.minimumLineSpacing = 0; + layout.minimumInteritemSpacing = 0; + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, 44, KScreenWidth, KScreenHeight-44) + collectionViewLayout:layout]; + _collectionView.delegate = self; + _collectionView.dataSource = self; + _collectionView.backgroundColor = [UIColor whiteColor]; + [RegionListCell registerTo:_collectionView]; + } + return _collectionView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.31_text_2") + font:kFontSemibold(16) + textColor:UIColorFromRGB(0x313131)]; + } + return _titleLabel; +} + +- (UIButton *)comfirmButton { + if (!_comfirmButton) { + _comfirmButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_comfirmButton setTitleColor:UIColorFromRGB(0xFF8C03) forState:UIControlStateNormal]; + [_comfirmButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal]; + [_comfirmButton addTarget:self + action:@selector(didTapComfirm) + forControlEvents:UIControlEventTouchUpInside]; + } + return _comfirmButton; +} + +- (UITextField *)findTextFieldInSearchBar:(UISearchBar *)searchBar { + for (UIView *subview in searchBar.subviews) { + for (UIView *nestedSubview in subview.subviews) { + if ([nestedSubview isKindOfClass:[UITextField class]]) { + return (UITextField *)nestedSubview; + } + } + } + return nil; +} + +- (UIView *)bgView { + if (!_bgView) { + UIView *bg = [[UIView alloc] init]; + bg.backgroundColor = [UIColor whiteColor]; + [bg setCornerRadius:16 cornerMask:kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner]; + bg.userInteractionEnabled = NO; + _bgView = bg; + } + return _bgView; +} +@end diff --git a/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m b/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m index f1e561ea..67cc9368 100644 --- a/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m @@ -39,6 +39,12 @@ [super viewDidLoad]; [self setup]; [self preLoadGifts]; + +//#if DEBUG +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self performSelector:@selector(completeUserInfo)]; +// }); +//#endif } /// 禮物面板緩存-1: 登錄後,用空的 roomUid 預加載默認禮物,並緩存 diff --git a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m index 66b8b50d..3d2b48ec 100644 --- a/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPNewHomeViewController.m @@ -12,6 +12,7 @@ #import #import #import +#import "SDWebImageManager.h" ///Tool #import "Api+Home.h" #import "YUMIMacroUitls.h" @@ -52,10 +53,192 @@ #import "BaseNavigationController.h" #import "XPAdImageTool.h" #import "PIHomeCategoryTitleModel.h" + +#import "RegionListViewController.h" + UIKIT_EXTERN NSString * kHomeMoreScrollPageKey; UIKIT_EXTERN NSString * const kOpenRoomNotification; -@interface XPNewHomeViewController () + +@interface HomeCategoryTabListCell : UICollectionViewCell +@property(nonatomic, assign) BOOL isSelected; +@property(nonatomic, strong) UIView *selectedBackground; +@property(nonatomic, strong) NetImageView *iconImageView; +@property(nonatomic, strong) PIHomeCategoryTitleModel *cellModel; +@property(nonatomic, copy) void(^didTapCategoryModel)(PIHomeCategoryTitleModel *model); +@end + +@implementation HomeCategoryTabListCell + +- (instancetype)initWithFrame:(CGRect)frame +{ + if (self = [super initWithFrame:frame]) { + self.backgroundColor = [UIColor clearColor]; + + [self.contentView setCornerRadius:15]; + self.contentView.backgroundColor = [UIColor whiteColor]; + [self.contentView addSubview:self.selectedBackground]; + [self.selectedBackground mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView); + }]; + + [self.contentView addSubview:self.iconImageView]; + [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.contentView); + make.size.mas_equalTo(CGSizeMake(36, 23)); + }]; + } + return self; +} + +- (void)setSelected:(BOOL)selected { + [super setSelected:selected]; + self.selectedBackground.hidden = !selected; + if (selected && self.didTapCategoryModel) { + self.didTapCategoryModel(self.cellModel); + } +} + +#pragma mark - +- (UIView *)selectedBackground { + if (!_selectedBackground) { + _selectedBackground = [[UIView alloc] init]; + _selectedBackground.backgroundColor = [UIColor whiteColor]; + [_selectedBackground setCornerRadius:15 + corners:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner + borderWidth:1 + borderColor:UIColorFromRGB(0xFF8C03)]; + _selectedBackground.hidden = YES; + } + return _selectedBackground; +} + +- (NetImageView *)iconImageView { + if (!_iconImageView) { + _iconImageView = [[NetImageView alloc] init]; + } + return _iconImageView; +} + +@end + +@interface HomeCategoryTabList : UIView +@property(nonatomic, strong) UIButton *arrowButton; +@property(nonatomic, strong) UICollectionView *tabCollectionView; +@property(nonatomic, copy) NSArray *tabArray; +@property(nonatomic, copy) void(^didTapCategoryModel)(PIHomeCategoryTitleModel *model); +@property(nonatomic, copy) void(^didTapArrow)(void); + +- (void)closeArrow; + +@end + +@implementation HomeCategoryTabList + +- (instancetype)init { + if (self = [super init]) { + self.backgroundColor = [[ClientConfig shareConfig] bgColor];; + [self addSubview:self.arrowButton]; + [self.arrowButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self); + make.size.mas_equalTo(CGSizeMake(24, 24)); + make.trailing.mas_equalTo(-15); + }]; + + [self addSubview:self.tabCollectionView]; + [self.tabCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_equalTo(self); + make.leading.mas_equalTo(0); + make.trailing.mas_equalTo(self.arrowButton.mas_leading); + }]; + } + return self; +} + +- (void)handleTapArrow { + if (_didTapArrow) { + self.didTapArrow(); + } +} + +- (void)setTabArray:(NSArray *)tabArray { + _tabArray = tabArray; + [self.tabCollectionView reloadData]; + if (tabArray.count > 0) { + [self.tabCollectionView selectItemAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] + animated:NO + scrollPosition:UICollectionViewScrollPositionNone]; + } +} + +- (void)closeArrow { + +} + +#pragma mark - +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.tabArray.count; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + HomeCategoryTabListCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HomeCategoryTabListCell" forIndexPath:indexPath]; + cell.cellModel = [self.tabArray xpSafeObjectAtIndex:indexPath.row]; + @kWeakify(self); + [cell setDidTapCategoryModel:^(PIHomeCategoryTitleModel *model) { + @kStrongify(self); + if (self.didTapCategoryModel) { + self.didTapCategoryModel(model); + } + }]; + return cell; +} + +#pragma mark - +- (UIButton *)arrowButton { + if (!_arrowButton) { + _arrowButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _arrowButton.backgroundColor = [UIColor yellowColor]; + [_arrowButton setImage:kImage(@"common_down_arrow") + forState:UIControlStateNormal]; + [_arrowButton addTarget:self + action:@selector(handleTapArrow) + forControlEvents:UIControlEventTouchUpInside]; + } + return _arrowButton; +} + +- (UIScrollView *)tabCollectionView { + if (!_tabCollectionView) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(46, 30); + layout.minimumLineSpacing = 12; + layout.minimumInteritemSpacing = 12; + layout.sectionInset = UIEdgeInsetsMake(0, 14, 0, 0); + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + _tabCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero + collectionViewLayout:layout]; + _tabCollectionView.backgroundColor = [UIColor clearColor]; + _tabCollectionView.showsHorizontalScrollIndicator = NO; + _tabCollectionView.delegate = self; + _tabCollectionView.dataSource = self; + [_tabCollectionView registerClass:[HomeCategoryTabListCell class] + forCellWithReuseIdentifier:@"HomeCategoryTabListCell"]; + } + return _tabCollectionView; +} + +@end + + +@interface XPNewHomeViewController ()< +JXPagerViewDelegate, +JXPagerMainTableViewGestureDelegate, +JXCategoryViewDelegate, +XPHomeContainerProtocol, +XPNewHomeNavViewDelegate, +XPNewHomeHeadViewDelegate, +XPHomeRecommendOtherRoomViewDelegate, +XPHomeRecommendViewControllerDelegate> ///头视图 @property(nonatomic,strong) XPNewHomeHeadView *headView; @@ -63,6 +246,8 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; @property (nonatomic, strong) NSMutableArray *tagModelList; ///分页控件 @property (nonatomic, strong) JXCategoryTitleView *titleView; +@property(nonatomic, strong) HomeCategoryTabList *categoryTagList; + ///分页lineView @property (nonatomic, strong) JXPagerView *pagingView; @@ -137,6 +322,18 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; kWindow.rootViewController = nav; XPAdImageTool.shareImageTool.isImLogin = NO; } + +- (void)createTagScrollView { + if (_categoryTagList) { + return; + } + + [self.titleView addSubview:self.categoryTagList]; + [self.categoryTagList mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.titleView); + }]; +} + #pragma mark - Private Method - (void)initSubViews { @@ -244,6 +441,19 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; }]; } +- (void)showAllTags { + RegionListViewController *vc = [[RegionListViewController alloc] initForHomeTags]; + @kWeakify(self); + vc.handleDismiss = ^{ + @kStrongify(self); + [self.categoryTagList closeArrow]; + }; + vc.handleTapComfirm = ^(id _Nonnull obj) { + + }; + [self presentViewController:vc animated:YES completion:^{ }]; +} + #pragma mark - XPNewHomeNavViewDelegate - (void)xPNewHomeNavView:(XPNewHomeNavView *)view didClickRank:(UIButton *)sender { XPWebViewController * webVC =[[XPWebViewController alloc] initWithRoomUID:nil]; @@ -310,7 +520,7 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; return self.headView; } - (NSUInteger)heightForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { - return kGetScaleWidth(30); + return kGetScaleWidth(40); } - (UIView *)viewForPinSectionHeaderInPagerView:(JXPagerView *)pagerView { return self.titleView; @@ -342,7 +552,6 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; return self.view; } - #pragma mark - JXPagerMainTableViewGestureDelegate - (BOOL)mainTableViewGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { //禁止categoryView左右滑动的时候,上下和左右都可以滚动 @@ -403,11 +612,14 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; } } self.tagModelList = list; - + self.titleView.titles = titleArray; [self.titleView reloadData]; - + + [self createTagScrollView]; + [self.categoryTagList setTabArray:list]; } + - (void)homeChatPickSuccess:(NSString *)uid { /// 跳聊天 NSString *sessionId = uid; @@ -521,17 +733,11 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; _titleView.cellSpacing = kGetScaleWidth(20); _titleView.listContainer = (id)self.pagingView.listContainerView; - -// JXCategoryIndicatorImageView * indicator = [[JXCategoryIndicatorImageView alloc] init]; -// indicator.indicatorImageView.image = kImage(@"ms_login_choose_phone_icon"); -// indicator.indicatorImageViewSize = CGSizeMake(kGetScaleWidth(24), kGetScaleWidth(24)); -// indicator.verticalMargin = -kGetScaleWidth(4); -// indicator.contentMode = UIViewContentModeScaleAspectFit; -// _titleView.indicators = @[indicator]; } return _titleView; } + - (NSMutableArray *)tagModelList{ if(!_tagModelList){ _tagModelList = [NSMutableArray array]; @@ -578,4 +784,21 @@ UIKIT_EXTERN NSString * const kOpenRoomNotification; } return _validListDict; } + +- (HomeCategoryTabList *)categoryTagList { + if (!_categoryTagList) { + _categoryTagList = [[HomeCategoryTabList alloc] init]; + @kWeakify(self); + [_categoryTagList setDidTapArrow:^{ + @kStrongify(self); + [self showAllTags]; + }]; + [_categoryTagList setDidTapCategoryModel:^(PIHomeCategoryTitleModel *model) { + @kStrongify(self); + NSInteger index = [self.tagModelList indexOfObject:model]; + [self.titleView selectItemAtIndex:index]; + }]; + } + return _categoryTagList; +} @end diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m index cebfa7be..94c3c6ac 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m @@ -1098,7 +1098,7 @@ GiftAnimationDelegate> #pragma mark - 进房动画 XXX来了 - (void)userEnterRoom:(NIMChatroomNotificationContent *)content ext:(XPMessageRemoteExtModel *)extModel { - NSString *userName = content.source.nick; + NSString *userName = [NSString isEmpty:extModel.nick] ? content.source.nick : extModel.nick; if ([NSString isEmpty:userName] && content.source.userId.intValue == self.delegate.getUserInfo.uid) { userName = self.delegate.getUserInfo.nick; } else if ([NSString isEmpty:userName]) { @@ -1695,21 +1695,6 @@ GiftAnimationDelegate> } #pragma mark - 全服礼物 飘屏 -- (void)receiveBroadcastGift:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - GiftReceiveInfoModel *giftNotifyInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; - ///年度飘屏是广播 在tabbar中监听 - if (giftNotifyInfo.ceremonyGift)return; - // if(giftNotifyInfo.isHomeShow == YES)return; ///房间外飘屏 在tabbar中监听 - // if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///自己的房间跨房间飘屏不用走 - if (self.animationListA.count == 0 && - self.isPlayOfB == NO && - self.isPlayOfA == NO) { - [self createGiftBroadcastViewAnimation:giftNotifyInfo]; - } - [self.animationListA addObject:giftNotifyInfo]; -} - - (void)createGiftBroadcastViewAnimation:(GiftReceiveInfoModel *)giftModel { self.isPlayOfA = YES; XPRoomGiftBroadcastView * view = [[XPRoomGiftBroadcastView alloc] init]; diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m index 2d69170b..3a87756b 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m @@ -444,6 +444,9 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; [self.moreButton mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(36); }]; + [self.arrangeMicButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.height.mas_equalTo(36); + }]; [self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(46, 46)); diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m index 81201861..e3cce6be 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m @@ -1014,7 +1014,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; self.isMiniEnter = NO; NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; - RoomInfoModel * roomInfo = self.hostDelegate.getRoomInfo; + RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo; if (content.eventType == NIMChatroomEventTypeEnter) { if (roomInfo.isCloseScreen) { diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/Cell/XPGiftItemCollectionViewCell.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/Cell/XPGiftItemCollectionViewCell.m index 86723d13..16d573f4 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/Cell/XPGiftItemCollectionViewCell.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/Cell/XPGiftItemCollectionViewCell.m @@ -106,7 +106,6 @@ make.edges.mas_equalTo(self); }]; - [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.top.mas_equalTo(self.contentView).offset(18); make.centerX.mas_equalTo(self.contentView); diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftSuperGiftBroadcastView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftSuperGiftBroadcastView.m index a5d879c1..b5a55dd7 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftSuperGiftBroadcastView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/PIGiftSuperGiftBroadcastView.m @@ -35,8 +35,12 @@ -(void)setGiftModel:(GiftInfoModel *)giftModel{ _giftModel = giftModel; _bgImageView.imageUrl = _giftModel.bannerUrl; + } -(void)clickBtnAction{ + if ([NSString isEmpty:_giftModel.bannerUrl]) { + return; + } if (self.delegate && [self.delegate respondsToSelector:@selector(pIGiftSuperGiftBroadcastViewClickWithModel:)]){ [self.delegate pIGiftSuperGiftBroadcastViewClickWithModel:self.giftModel]; } diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 076d5cf3..a964eafe 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -633,6 +633,9 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; } #pragma mark - PIGiftSuperGiftBroadcastViewDelegate - (void)pIGiftSuperGiftBroadcastViewClickWithModel:(GiftInfoModel *)giftModel{ + if ([NSString isEmpty:giftModel.skipUrl]) { + return; + } XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init]; webView.url = giftModel.skipUrl; [TTPopup popupView:webView style:TTPopupStyleActionSheet]; diff --git a/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroWaveView.m b/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroWaveView.m index c8510019..301c2cff 100644 --- a/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroWaveView.m +++ b/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroWaveView.m @@ -41,10 +41,13 @@ if (self.isAnimationing) { return; } - self.isAnimationing = YES; + + if (self.isAnimationing) { + [self.firstView.layer removeAllAnimations]; + } + self.isAnimationing = YES; self.firstView.hidden = NO; - [self animationWithLayer:self.firstView]; - + [self animationWithLayer:self.firstView]; } ///结束声波动画 - (void)stopWaveAnimation { @@ -70,7 +73,7 @@ - (void)animationWithLayer:(UIView *)view { int animtionDura = 1; POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerScaleXY]; - animation2.beginTime = CACurrentMediaTime(); + animation2.beginTime = CACurrentMediaTime(); animation2.duration = animtionDura; animation2.fromValue = [NSValue valueWithCGSize:CGSizeMake(1.f, 1.f)]; animation2.toValue = [NSValue valueWithCGSize:CGSizeMake(1.4f, 1.4f)]; diff --git a/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.h b/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.h new file mode 100644 index 00000000..ec28836d --- /dev/null +++ b/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.h @@ -0,0 +1,16 @@ +// +// NineteenMicStageView.h +// YuMi +// +// Created by P on 2024/12/12. +// + +#import "StageView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface NineteenMicStageView : StageView + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.m b/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.m new file mode 100644 index 00000000..61a52f53 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/StageView/NineteenMicStageView.m @@ -0,0 +1,131 @@ +// +// NineteenMicStageView.m +// YuMi +// +// Created by P on 2024/12/12. +// + +#import "NineteenMicStageView.h" +#import "ArabMicroView.h" + +//第一行距离顶部 +#define firstRowTopMargin 60 +// 房主头像宽 58 + 光圈 5 +#define ownerWidth (45 + 5) * kScreenScale +// 昵称高12,距离头像间距 10 +#define ownerHeight (ownerWidth + 10 + 12) +// 下面 8 个坑位宽55 + 光圈 5 +#define mcWidth (45 + 5) * kScreenScale +#define mcHeight (mcWidth + 10 + 12 + 5+16) +// 左右 padding 20 +#define paddingH 22 * kScreenScale +// 每行间距 +#define lineMargin 8 +// 下面 8 个坑位两两之间的间距 +#define marginH (KScreenWidth - paddingH * 2 - mcWidth * 5) / 4 +// 第二行坑位的顶部 +#define sRowTop firstRowTopMargin + mcHeight + lineMargin +// 第一行坑位与第二行坑位的间距 +//#define marginV2 15 +// 第三行坑位的顶部 +#define tRowTop (sRowTop + mcHeight + lineMargin) + +static const NSInteger kMicCountPerRow = 5; + +@implementation NineteenMicStageView + +- (NSInteger)countOfMicroView { + return 19; // 麦位总数 +} + +- (UIView *)microViewForIndex:(NSInteger)index { + UIView *microView = [super microViewForIndex:index]; + return microView ?: [[ArabMicroView alloc] init]; +} + +- (CGRect)rectForViewAtIndex:(NSInteger)index { + if (index < 0 || index >= [self countOfMicroView]) { + return CGRectZero; + } + + // 第一行(5列) + if (index >= 0 && index < 5) { + return [self calculateRectForRow:0 column:index columnsInRow:5]; + } + + // 第二行(4列,居中) + if (index >= 5 && index < 9) { + return [self calculateRectForRow:1 column:index - 5 columnsInRow:4]; + } + + // 第三行(4列,居中) + if (index >= 9 && index < 13) { + return [self calculateRectForRow:2 column:index - 9 columnsInRow:4]; + } + + // 第四行(5列) + if (index >= 13 && index < 18) { + return [self calculateRectForRow:3 column:index - 13 columnsInRow:5]; + } + + // 第五行(最后一个麦位,居中,尺寸为2倍) + if (index == 18) { + CGFloat x = (KScreenWidth - mcWidth * 1.5) / 2; // 水平方向居中 +// CGFloat y = firstRowTopMargin + (mcHeight + lineMargin) * 2 - mcHeight; // 垂直方向在第 2 和第 3 行交界 + CGFloat y = firstRowTopMargin + 1 * (mcHeight + lineMargin) + mcHeight/2; + return CGRectMake(x, y, mcWidth * 1.5, mcHeight * 1.5); + } + + return CGRectZero; +} + +- (CGRect)calculateRectForRow:(NSInteger)row column:(NSInteger)column columnsInRow:(NSInteger)columnsInRow { +// CGFloat totalWidth = columnsInRow * mcWidth + (columnsInRow - 1) * marginH; // 当前行的总宽度 +// CGFloat startX = (KScreenWidth - totalWidth) / 2; // 居中计算起点 +// CGFloat x = startX + column * (mcWidth + marginH); +// CGFloat y = firstRowTopMargin + row * (mcHeight + lineMargin); +// return CGRectMake(x, y, mcWidth, mcHeight); + + CGFloat totalWidth = columnsInRow * mcWidth + (columnsInRow - 1) * marginH; // 当前行的总宽度 + CGFloat startX = (KScreenWidth - totalWidth) / 2; // 居中计算起点 + CGFloat x = 0; + + if (row == 1 || row == 2) { // 特殊处理第 2、3 行 + if (column < 2) { + // 第一、二列,从左侧开始布局 + x = paddingH + column * (mcWidth + marginH); + } else { + // 第三、四列,从右侧开始布局 + NSInteger reversedColumn = columnsInRow - 1 - column; + x = KScreenWidth - paddingH - mcWidth - reversedColumn * (mcWidth + marginH); + } + } else { + // 默认居中布局 + x = startX + column * (mcWidth + marginH); + } + + CGFloat y = firstRowTopMargin + row * (mcHeight + lineMargin); + return CGRectMake(x, y, mcWidth, mcHeight); +} + +- (CGFloat)hightForStageView { + CGFloat lastRowBottom = firstRowTopMargin + 3 * (mcHeight + lineMargin) + mcHeight; + return lastRowBottom + lineMargin; // 加上最后的间距 +} + +- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid { + NSInteger index = [self getIndexByUid:uid]; + return [self animationPointAtStageViewByIndex:index]; +} + +- (CGPoint)animationPointAtStageViewByIndex:(NSInteger)index { + if (index < 0 || index >= [self countOfMicroView]) { + return CGPointZero; + } + + CGRect rect = [self rectForViewAtIndex:index]; + CGPoint center = CGPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)); + return [self convertPoint:center toView:nil]; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/StageView/StageView.m b/YuMi/Modules/YMRoom/View/StageView/StageView.m index 77eba48b..fb3e43bf 100644 --- a/YuMi/Modules/YMRoom/View/StageView/StageView.m +++ b/YuMi/Modules/YMRoom/View/StageView/StageView.m @@ -40,6 +40,8 @@ #import "XPUserCardViewController.h" #import "XPRoomInviteUserViewController.h" +#import "UserRoomCardViewController.h" + @interface StageView() /** 云信麦序的 position 和本类 index 的关系。 @@ -353,73 +355,85 @@ 更新坑位的等级头饰 */ - (void)updatePositionItemWithRoomOnMicGiftValue:(GiftValueInfoModel *)roomOnMicGiftValue{ - if (self.hostDelegate.getRoomInfo.type == RoomType_Anchor || self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) return; - // 过滤礼物值为0的 - NSMutableArray *validGifts = [NSMutableArray array]; + if (self.hostDelegate.getRoomInfo.type == RoomType_Anchor || + self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) { + return; + } + + // Step 1: 过滤有效礼物 + NSArray *validGifts = [self filterValidGifts]; + if (validGifts.count == 0) return; + + // Step 3: 排序 + NSArray *sortedGifts = [self sortGiftsByValue:validGifts]; + + NSString *highest = nil; + NSString *lowest = nil; + + // 处理最高礼物值 + if (sortedGifts.count >= 1 && ![self hasDuplicateHighestValue:sortedGifts]) { + highest = sortedGifts.firstObject.uid; + } + // 处理最低礼物值 + if (sortedGifts.count > 1 && ![self hasDuplicateLowestValue:sortedGifts]) { + lowest = sortedGifts.lastObject.uid; + } + + // Step 4: 更新 UI + [self updateMicroViewsWithHighest:highest lowest:lowest]; +} + +// 筛选有效礼物值 +- (NSArray *)filterValidGifts { + NSMutableArray *validGifts = [NSMutableArray array]; for (int i = 0; i < self.microViews.count; i++) { - - UIView * view = [self findMicroViewByIndex:i]; + UIView *view = [self findMicroViewByIndex:i]; [view hiddenPositionisHighLevel]; long long value = [view getGiftValue]; UserInfoModel *user = [view getUser]; - if(value > 0 && user.uid > 0){ + if (value > 0 && user.uid > 0) { GiftValueDetailModel *model = [GiftValueDetailModel new]; model.giftValue = value; model.uid = @(user.uid).stringValue; [validGifts addObject:model]; } } - if (validGifts.count == 0) return; - NSMutableArray *newOnMicGifts = [NSMutableArray array]; - // 过滤厅主 - for (GiftValueDetailModel *value in validGifts) { - for (MicroQueueModel *item in self.micQueue.allValues) { - BOOL isOwnerPosition = item.microState.position == -1; - if (!isOwnerPosition && item.userInfo.uid == value.uid.integerValue) { - [newOnMicGifts addObject:value]; - } - } - } - if (newOnMicGifts.count == 0) return; - // 排序 - NSSortDescriptor *giftValueSortD = [NSSortDescriptor sortDescriptorWithKey:@"giftValue" ascending:NO]; - NSArray *giftValuesSortArray = [[newOnMicGifts sortedArrayUsingDescriptors:@[giftValueSortD]] mutableCopy]; - NSString *highest = nil; - NSString *lowest = nil; - NSInteger sortArrayCount = giftValuesSortArray.count; - if (sortArrayCount == 1) { - highest = giftValuesSortArray.firstObject.uid; - }else if (sortArrayCount == 2) { - if (giftValuesSortArray.firstObject.giftValue != giftValuesSortArray.lastObject.giftValue) { - highest = giftValuesSortArray.firstObject.uid; - lowest = giftValuesSortArray.lastObject.uid; - } - }else{ - // 如果第一个和最后一个不相等 - if (giftValuesSortArray.firstObject.giftValue != giftValuesSortArray.lastObject.giftValue) { - // 如果第一个和第二个不相等,则必有最高 - if (giftValuesSortArray.firstObject.giftValue != giftValuesSortArray[1].giftValue) { - highest = giftValuesSortArray.firstObject.uid; - } - // 如果最后一个和倒数第二个不相等,则必有最低 - if (giftValuesSortArray.lastObject.giftValue != giftValuesSortArray[sortArrayCount-2].giftValue) { - lowest = giftValuesSortArray.lastObject.uid; - } - } - } + + return validGifts; +} - for (MicroQueueModel *item in self.micQueue.allValues) { - if (highest && item.userInfo.uid == highest.integerValue) { - UIView * view = [self findMicroViewByUid:highest]; - [view updatePositionIsHighLevel:YES isShow:YES]; - continue; - } - if (lowest && item.userInfo.uid == lowest.integerValue) { - UIView * view = [self findMicroViewByUid:lowest]; - [view updatePositionIsHighLevel:NO isShow:YES]; - } - } +// 根据礼物值排序 +- (NSArray *)sortGiftsByValue:(NSArray *)gifts { + NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"giftValue" ascending:NO]; + return [gifts sortedArrayUsingDescriptors:@[sortDescriptor]]; +} + +// 检查是否存在相同最高值 +- (BOOL)hasDuplicateHighestValue:(NSArray *)sortedGifts { + if (sortedGifts.count < 2) return NO; + return sortedGifts[0].giftValue == sortedGifts[1].giftValue; +} + +// 检查是否存在相同最低值 +- (BOOL)hasDuplicateLowestValue:(NSArray *)sortedGifts { + if (sortedGifts.count < 2) return NO; + return sortedGifts[sortedGifts.count - 1].giftValue == sortedGifts[sortedGifts.count - 2].giftValue; +} + +// 更新视图 +- (void)updateMicroViewsWithHighest:(NSString *)highest lowest:(NSString *)lowest { + for (MicroQueueModel *item in self.micQueue.allValues) { + UIView *view = nil; + + if (highest && item.userInfo.uid == highest.integerValue) { + view = [self findMicroViewByUid:highest]; + [view updatePositionIsHighLevel:YES isShow:YES]; + } else if (lowest && item.userInfo.uid == lowest.integerValue) { + view = [self findMicroViewByUid:lowest]; + [view updatePositionIsHighLevel:NO isShow:YES]; + } + } } #pragma mark - RoomGuestDelegate @@ -819,6 +833,7 @@ } if (targetUid && targetUid.length > 0) { + XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init]; model.uid = targetUid; model.position = position; @@ -829,6 +844,14 @@ model.micQueue = self.micQueue; model.delegate = self.hostDelegate; model.superMangerList = self.hostDelegate.getRoomSuperAdminList; + +#if DEBUG + UserRoomCardViewController *vc = [[UserRoomCardViewController alloc] initWithUser:model]; + vc.modalPresentationStyle = UIModalPresentationOverFullScreen; + [self.hostDelegate.getCurrentNav presentViewController:vc animated:NO completion:nil]; + return; +#endif + XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model]; [self.hostDelegate.getCurrentNav presentViewController:userCardVC animated:NO completion:nil]; [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventroom_mike_click eventAttributes:@{@"actionType" : @"userCard"}]; diff --git a/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.h b/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.h new file mode 100644 index 00000000..1cfd4c88 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.h @@ -0,0 +1,18 @@ +// +// TwentyMicStageView.h +// YuMi +// +// Created by P on 2024/12/12. +// + +#import "StageView.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface TwentyMicStageView : StageView + +//- (instancetype)initWithRows:(NSInteger)rows columns:(NSInteger)columns; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.m b/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.m new file mode 100644 index 00000000..71c7186a --- /dev/null +++ b/YuMi/Modules/YMRoom/View/StageView/TwentyMicStageView.m @@ -0,0 +1,87 @@ +// +// TwentyMicStageView.m +// YuMi +// +// Created by P on 2024/12/12. +// + +#import "TwentyMicStageView.h" +#import "ArabMicroView.h" + +//第一行距离顶部 +#define firstRowTopMargin 60 +// 房主头像宽 58 + 光圈 5 +#define ownerWidth (45 + 5) * kScreenScale +// 昵称高12,距离头像间距 10 +#define ownerHeight (ownerWidth + 10 + 12) +// 下面 8 个坑位宽55 + 光圈 5 +#define mcWidth (45 + 5) * kScreenScale +#define mcHeight (mcWidth + 10 + 12 + 5+16) +// 左右 padding 20 +#define paddingH 22 * kScreenScale +// 每行间距 +#define lineMargin 8 +// 下面 8 个坑位两两之间的间距 +#define marginH (KScreenWidth - paddingH * 2 - mcWidth * 5) / 4 +// 第二行坑位的顶部 +#define sRowTop firstRowTopMargin + mcHeight + lineMargin +// 第一行坑位与第二行坑位的间距 +//#define marginV2 15 +// 第三行坑位的顶部 +#define tRowTop (sRowTop + mcHeight + lineMargin) + +@interface TwentyMicStageView () + +@end + +@implementation TwentyMicStageView + +static const NSInteger kMicCountPerRow = 5; + +- (NSInteger)countOfMicroView { + return 20; +} + +- (UIView *)microViewForIndex:(NSInteger)index { + UIView *microView = [super microViewForIndex:index]; + return microView ?: [[ArabMicroView alloc] init]; +} + +- (CGRect)rectForViewAtIndex:(NSInteger)index { + if (index < 0 || index >= [self countOfMicroView]) { + return CGRectZero; + } + CGPoint position = [self positionForIndex:index rowHeight:mcHeight]; + return CGRectMake(position.x - mcWidth / 2, position.y - mcHeight / 2, mcWidth, mcHeight); +} + +- (CGFloat)hightForStageView { + NSInteger rows = ceil((CGFloat)[self countOfMicroView] / kMicCountPerRow); + return firstRowTopMargin + rows * (mcHeight + lineMargin) - lineMargin; +} + +- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid { + NSInteger index = [self getIndexByUid:uid]; + return [self animationPointAtStageViewByIndex:index]; +} + +- (CGPoint)animationPointAtStageViewByIndex:(NSInteger)index { + if (index < 0 || index >= [self countOfMicroView]) { + return CGPointZero; + } + CGPoint position = [self positionForIndex:index rowHeight:mcHeight]; + return [self convertPoint:position toView:nil]; +} + +#pragma mark - Helper Methods + +- (CGPoint)positionForIndex:(NSInteger)index rowHeight:(CGFloat)rowHeight { + NSInteger row = index / kMicCountPerRow; + NSInteger col = index % kMicCountPerRow; + CGFloat x = paddingH + col * (mcWidth + marginH) + mcWidth / 2; + CGFloat y = firstRowTopMargin + row * (rowHeight + lineMargin) + rowHeight / 2; + return CGPointMake(x, y); +} + + +@end diff --git a/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m b/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m index 4891a21c..39e6b040 100644 --- a/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m +++ b/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m @@ -198,7 +198,6 @@ item.isEnable = NO; item.imageName = @"usercard_invite_micro_disable"; } else { - item.isEnable = YES; item.imageName = @"usercard_invite_micro_normal"; } @@ -219,7 +218,7 @@ NSMutableArray * array = [NSMutableArray array]; XPUserCardMicroItemModel * muteItem = [[XPUserCardMicroItemModel alloc] init]; muteItem.title = userInfo.micState == MicroMicStateType_Open ? YMLocalizedString(@"XPUserCardPresenter5") : YMLocalizedString(@"XPUserCardPresenter6"); - muteItem.iconImage = userInfo.micState == MicroMicStateType_Open ? @"user_card_close_mic" : @"user_card_open_mic"; + muteItem.iconImage = userInfo.micState == MicroMicStateType_Open ? @"room_user_card_close_mic" : @"room_user_card_open_mic"; muteItem.status = userInfo.micState == MicroMicStateType_Open; muteItem.type = UserCardMicroType_Mute; @@ -228,11 +227,11 @@ upDownItem.status = userInfo.position.length > 0 ? YES : NO; upDownItem.type = UserCardMicroType_UpDown; upDownItem.uid = userInfo.uid; - upDownItem.iconImage = @"user_card_down_mic_listen"; + upDownItem.iconImage = @"room_user_card_out_mic"; XPUserCardMicroItemModel * lockItem = [[XPUserCardMicroItemModel alloc] init]; lockItem.title = userInfo.posState == MicroPosStateType_Free ? YMLocalizedString(@"XPUserCardPresenter10") : YMLocalizedString(@"XPUserCardPresenter11"); - lockItem.iconImage = userInfo.posState == MicroPosStateType_Free ? @"user_card_lock_mic" : @"user_card_no_lock_mic"; + lockItem.iconImage = userInfo.posState == MicroPosStateType_Free ? @"room_user_card_lock" : @"room_user_card_unlock"; lockItem.status = userInfo.posState == MicroPosStateType_Free; lockItem.type = UserCardMicroType_Lock; @@ -240,7 +239,7 @@ XPUserCardMicroItemModel * giftValueItem = [[XPUserCardMicroItemModel alloc] init]; giftValueItem.title = YMLocalizedString(@"XPUserCardPresenter12"); - giftValueItem.iconImage = @"user_card_clean_gift_value"; + giftValueItem.iconImage = @"room_user_card_clean_gift_value"; giftValueItem.type = UserCardMicroType_Clean_Gift_Value; ///自己是公会超管 BOOL meIsSuperAdmin = NO; @@ -628,8 +627,8 @@ if (!_giftItem) { _giftItem = [[XPUserCardItemModel alloc] init]; _giftItem.title = YMLocalizedString(@"XPUserCardPresenter13"); - _giftItem.imageName = @"usercard_sendgift_normal"; - _giftItem.selectImageName = @"usercard_sendgift_normal"; + _giftItem.imageName = @"room_user_card_send_gift"; + _giftItem.selectImageName = @"room_user_card_send_gift"; _giftItem.type = UserCardItemType_Gift; } return _giftItem; @@ -639,8 +638,8 @@ if (!_chatItem) { _chatItem = [[XPUserCardItemModel alloc] init]; _chatItem.title = YMLocalizedString(@"XPUserCardPresenter14"); - _chatItem.imageName = @"usercard_chat_normal"; - _chatItem.selectImageName = @"usercard_chat_normal"; + _chatItem.imageName = @"room_user_card_chat"; + _chatItem.selectImageName = @"room_user_card_chat"; _chatItem.type = UserCardItemType_Chat; } return _chatItem; @@ -650,8 +649,8 @@ if (!_atItem) { _atItem = [[XPUserCardItemModel alloc] init]; _atItem.title = YMLocalizedString(@"XPUserCardPresenter22"); - _atItem.imageName = @"usercard_chat_normal"; - _atItem.selectImageName = @"usercard_chat_normal"; + _atItem.imageName = @"room_user_card_at"; + _atItem.selectImageName = @"room_user_card_at"; _atItem.type = UserCardItemType_AtUser; } return _atItem; @@ -661,9 +660,9 @@ if (!_attentionItem) { _attentionItem = [[XPUserCardItemModel alloc] init]; _attentionItem.title = YMLocalizedString(@"XPUserCardPresenter15"); - _attentionItem.imageName = @"usercard_attention_normal"; + _attentionItem.imageName = @"room_user_card_follow"; _attentionItem.selectTitle = YMLocalizedString(@"XPUserCardPresenter16"); - _attentionItem.selectImageName = @"usercard_attention_disable"; + _attentionItem.selectImageName = @"room_user_card_unfollow"; _attentionItem.type = UserCardItemType_Attention; } return _attentionItem; @@ -673,8 +672,8 @@ if (!_kikoutItem) { _kikoutItem = [[XPUserCardItemModel alloc] init]; _kikoutItem.title = YMLocalizedString(@"XPUserCardPresenter17"); - _kikoutItem.imageName = @"usercard_kickout_normal"; - _kikoutItem.selectImageName = @"usercard_kickout_normal"; + _kikoutItem.imageName = @"room_user_card_kick"; + _kikoutItem.selectImageName = @"room_user_card_kick"; _kikoutItem.type = UserCardItemType_KickOut; } return _kikoutItem; @@ -684,9 +683,9 @@ if (!_managerItem) { _managerItem = [[XPUserCardItemModel alloc] init]; _managerItem.title = YMLocalizedString(@"XPUserCardPresenter18"); - _managerItem.imageName = @"usercard_manager_normal"; + _managerItem.imageName = @"room_user_card_be_manager"; _managerItem.selectTitle = YMLocalizedString(@"XPUserCardPresenter19"); - _managerItem.selectImageName = @"usercard_manager_disable"; + _managerItem.selectImageName = @"room_user_card_not_manager"; _managerItem.type = UserCardItemType_Manager; } return _managerItem; @@ -696,7 +695,7 @@ if (!_blackItem) { _blackItem = [[XPUserCardItemModel alloc] init]; _blackItem.title = YMLocalizedString(@"XPUserCardPresenter20"); - _blackItem.imageName = @"usercard_blacklist_normal"; + _blackItem.imageName = @"room_user_card_blacklist"; _blackItem.type = UserCardItemType_Black; } return _blackItem; diff --git a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.h b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.h new file mode 100644 index 00000000..3557f85a --- /dev/null +++ b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.h @@ -0,0 +1,20 @@ +// +// UserRoomCardViewController.h +// YuMi +// +// Created by P on 2024/12/11. +// + +#import "MvpViewController.h" + +@class XPUserCardInfoModel; + +NS_ASSUME_NONNULL_BEGIN + +@interface UserRoomCardViewController : MvpViewController + +- (instancetype)initWithUser:(XPUserCardInfoModel *)cardInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m new file mode 100644 index 00000000..ab3d776f --- /dev/null +++ b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m @@ -0,0 +1,1500 @@ +// +// UserRoomCardViewController.m +// YuMi +// +// Created by P on 2024/12/11. +// + +#import "UserRoomCardViewController.h" + +#import "XPUserCardPresenter.h" +#import "XPRoomGiftAnimationParser.h" + +#import "XPSendGiftView.h" +#import "XPRoomSendTextView.h" +#import "XPRoomHalfMessageView.h" + +#import "UIView+VAP.h" +#import "MoliAvatar.h" +#import "UserInfoModel.h" +#import "XPKickUserModel.h" +#import "AttachmentModel.h" +#import "XPUserCardInfoModel.h" +#import "XPUserCardItemModel.h" +#import "XPUserCardMicroItemModel.h" + +@interface UserRoomCardInfoCell : UICollectionViewCell +@property(nonatomic, copy) void(^tapReport)(void); +@property(nonatomic, copy) void(^tapAvatar)(void); +@property(nonatomic, strong) UserInfoModel *userInfo; +@property(nonatomic, strong) MoliAvatar *avatar; +@property(nonatomic, strong) UIButton *reportButton; +@property(nonatomic, strong) UILabel *nameLabel; +@property(nonatomic, strong) UIButton *sexAgeButton; +@property(nonatomic, strong) UIImageView *latestMark; +@property(nonatomic, strong) UIImageView *sidMark; +@property(nonatomic, strong) UILabel *idLabel; +@property(nonatomic, strong) UIImageView *copyMark; + ++ (void)registerTo:(UICollectionView *)collectionView; ++ (UserRoomCardInfoCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + handleTapReport:(void(^)(void))tapReport + handleTapAvatar:(void(^)(void))tapAvatar; + +@end + +@implementation UserRoomCardInfoCell + ++ (void)registerTo:(UICollectionView *)collectionView { + [collectionView registerClass:[self class] + forCellWithReuseIdentifier:NSStringFromClass([self class])]; +} + ++ (UserRoomCardInfoCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + handleTapReport:(void(^)(void))tapReport + handleTapAvatar:(void(^)(void))tapAvatar { + UserRoomCardInfoCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class]) + forIndexPath:indexPath]; + [cell.contentView setBackgroundColor:[UIColor clearColor]]; + cell.userInfo = userInfo; + cell.tapReport = tapReport; + cell.tapAvatar = tapAvatar; + + return cell; +} + +- (void)didTapCopy { + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.string = [NSString stringWithFormat:@"%ld",self.userInfo.erbanNo]; + [XNDJTDDLoadingTool showSuccessWithMessage:YMLocalizedString(@"XPUserCardViewController24")]; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + self.clipsToBounds = NO; + self.contentView.clipsToBounds = NO; + [self.contentView addSubview:self.avatar]; + [self.avatar mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(-91/2); + make.width.height.mas_equalTo(91); + }]; + + [self.contentView addSubview:self.reportButton]; + [self.reportButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.contentView).offset(14); + make.trailing.mas_equalTo(self.contentView).offset(-8); + make.width.height.mas_equalTo(24); + }]; + + UIStackView *nameStack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.nameLabel, + self.sexAgeButton + ]]; + nameStack.distribution = UIStackViewDistributionEqualCentering; + nameStack.alignment = UIStackViewAlignmentCenter; + nameStack.spacing = 6; + [self.contentView addSubview:nameStack]; + [nameStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.avatar.mas_bottom).offset(23); + make.height.mas_equalTo(22); + }]; + + [self.sexAgeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(35, 16)); + }]; + + UIStackView *idStack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.latestMark, + self.sidMark, + self.idLabel, + self.copyMark + ]]; + idStack.distribution = UIStackViewDistributionEqualCentering; + idStack.alignment = UIStackViewAlignmentCenter; + idStack.spacing = 2; + [self.contentView addSubview:idStack]; + [idStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(nameStack.mas_bottom).offset(5); + make.height.mas_equalTo(14); + }]; + + UIButton *copyAction = [UIButton buttonWithType:UIButtonTypeCustom]; + [copyAction addTarget:self action:@selector(didTapCopy) forControlEvents:UIControlEventTouchUpInside]; + [idStack addSubview:copyAction]; + [copyAction mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(idStack); + }]; + + } + return self; +} + +- (void)setUserInfo:(UserInfoModel *)userInfo { + _userInfo = userInfo; + + if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) { + self.reportButton.hidden = YES; + } + + self.avatar.userInfo = userInfo; + + @kWeakify(self); + [self.avatar setHandleTapAvatar:^{ + @kStrongify(self); + if (self.tapAvatar) { + self.tapAvatar(); + } + }]; + + [self updateNameAndGenderInfo]; + [self updateIDInfo]; +} + +- (void)updateNameAndGenderInfo { + self.nameLabel.text = self.userInfo.nick; + UIImage *sexBackgroundImage = nil; + if (self.userInfo.gender == GenderType_Male) { + [self.sexAgeButton setImage:kImage(@"home_age_boy_icon") forState:UIControlStateNormal]; + sexBackgroundImage = [UIImage gradientColorImageFromColors:@[UIColorRGBAlpha(0x6BB3FF, 0.5),UIColorFromRGB(0x6BB3FF)] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(35, 16)]; + } else { + [self.sexAgeButton setImage:kImage(@"home_age_girl_icon") forState:UIControlStateNormal]; + sexBackgroundImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF2A0C3),UIColorFromRGB(0xEB74A6)] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(35, 16)]; + } + [self.sexAgeButton setTitle:[NSString getAgeWithBirth:self.userInfo.birth] + forState:UIControlStateNormal]; + [self.sexAgeButton setBackgroundImage:sexBackgroundImage + forState:UIControlStateNormal]; +} + +- (void)updateIDInfo { + NSString *text = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController0"), self.userInfo.erbanNo]; + self.idLabel.text = text; +} + +- (void)didTapReport { + if (self.tapReport) { + self.tapReport(); + } +} + +- (void)didTapAvatar { + if (self.tapAvatar) { + self.tapAvatar(); + } +} + +- (MoliAvatar *)avatar { + if (!_avatar) { + _avatar = [[MoliAvatar alloc] init]; + _avatar.clipsToBounds = NO; + } + return _avatar; +} + +- (UIButton *)reportButton { + if (!_reportButton) { + UIButton *report = [UIButton buttonWithType:UIButtonTypeCustom]; + [report setImage:kImage(@"room_user_card_report") + forState:UIControlStateNormal]; + [report addTarget:self action:@selector(didTapReport) forControlEvents:UIControlEventTouchUpInside]; + _reportButton = report; + } + return _reportButton; +} + +- (UILabel *)nameLabel { + if (!_nameLabel) { + _nameLabel = [[UILabel alloc] init]; + _nameLabel.font = kFontMedium(15); + _nameLabel.lineBreakMode = NSLineBreakByTruncatingTail; + _nameLabel.textColor = UIColorFromRGB(0x313131); + } + return _nameLabel; +} + +- (UIButton *)sexAgeButton { + if (!_sexAgeButton) { + _sexAgeButton = [[UIButton alloc] init]; + _sexAgeButton.titleLabel.font = [UIFont systemFontOfSize:10 weight:UIFontWeightMedium]; + [_sexAgeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _sexAgeButton.imageEdgeInsets = UIEdgeInsetsMake(0, 2, 0, 0); + _sexAgeButton.layer.cornerRadius = 14/2; + _sexAgeButton.layer.masksToBounds = YES; + [_sexAgeButton setContentHuggingPriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + [_sexAgeButton setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisVertical]; + } + return _sexAgeButton; +} + +- (UIImageView *)latestMark { + if (!_latestMark) { + _latestMark = [[UIImageView alloc] initWithImage:kImage(@"common_new_user")]; + } + return _latestMark; +} + +- (UIImageView *)sidMark { + if (!_sidMark) { + _sidMark = [[UIImageView alloc] initWithImage:kImage(@"common_icon_beautiful")]; // user_info_id_mark + } + return _sidMark; +} + +- (UIImageView *)copyMark { + if (!_copyMark) { + _copyMark = [[UIImageView alloc] initWithImage:kImage(@"user_card_copy")]; + } + return _copyMark; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [[UILabel alloc] init]; + _idLabel.font = kFontRegular(12); + _idLabel.lineBreakMode = NSLineBreakByTruncatingTail; + _idLabel.textColor = UIColorFromRGB(0x7b7b7d); + } + return _idLabel; +} + + + +@end + +@interface UserRoomCardNameplateCell : UICollectionViewCell + +@property(nonatomic, strong) UserInfoModel *userInfo; +///魅力等级 +@property (nonatomic,strong) NetImageView *charmImageView; +///VIPicon +@property (nonatomic, strong) NetImageView *vipIconImageView; +///等级 +@property (nonatomic,strong) NetImageView *experImageView; +///铭牌图片 1 +@property (nonatomic,strong) NetImageView *nameplateImageView_1; +///铭牌图片 2 +@property (nonatomic,strong) NetImageView *nameplateImageView_2; + ++ (void)registerTo:(UICollectionView *)collectionView; ++ (UserRoomCardNameplateCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo; +@end + +@implementation UserRoomCardNameplateCell + ++ (void)registerTo:(UICollectionView *)collectionView { + [collectionView registerClass:[self class] + forCellWithReuseIdentifier:NSStringFromClass([self class])]; +} ++ (UserRoomCardNameplateCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo { + UserRoomCardNameplateCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class]) + forIndexPath:indexPath]; + [cell.contentView setBackgroundColor:[UIColor clearColor]]; + cell.userInfo = userInfo; + return cell; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + UIStackView *line_1_Stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.charmImageView, + self.experImageView, + self.vipIconImageView, + self.nameplateImageView_1, + self.nameplateImageView_2 + ]]; + line_1_Stack.distribution = UIStackViewDistributionEqualSpacing; + line_1_Stack.alignment = UIStackViewAlignmentCenter; + line_1_Stack.spacing = 4; + [self.contentView addSubview:line_1_Stack]; + [line_1_Stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(0); + make.height.mas_equalTo(20); + }]; + + [self.experImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(34); + }]; + [self.charmImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(34); + }]; + [self.vipIconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(30); + }]; + + [self.nameplateImageView_1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(72); + }]; + + [self.nameplateImageView_2 mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(72); + }]; + } + return self; +} + +- (void)setUserInfo:(UserInfoModel *)userInfo { + [self loadNameplate:userInfo.userLevelVo.experUrl tagetView:self.experImageView]; + [self loadNameplate:userInfo.userLevelVo.charmUrl tagetView:self.charmImageView]; + [self loadNameplate:userInfo.userVipInfoVO.nameplateUrl tagetView:self.vipIconImageView]; + [self loadNameplate:userInfo.nameplatePic tagetView:self.nameplateImageView_1]; + [self loadNameplate:userInfo.guildNameplateIcon tagetView:self.nameplateImageView_2]; +} + +- (void)loadNameplate:(NSString *)urlPath tagetView:(NetImageView *)view { + if (![NSString isEmpty:urlPath]) { + view.hidden = NO; + [view loadImageWithUrl:urlPath + completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { + if (image) { + CGFloat height = 20; + CGSize imageSize = image.size; + view.image = image; + [view mas_updateConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(imageSize.width / imageSize.height * height); + }]; + [self.contentView layoutIfNeeded]; + } + }]; + } +} + +- (NetImageView *)charmImageView { + if (!_charmImageView) { + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserCardLevel; + _charmImageView = [[NetImageView alloc] initWithConfig:config]; + _charmImageView.userInteractionEnabled = YES; + _charmImageView.hidden = YES; + _charmImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _charmImageView; +} + +- (NetImageView *)vipIconImageView { + if (!_vipIconImageView) { + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserCardLevel; + _vipIconImageView = [[NetImageView alloc] initWithConfig:config]; + _vipIconImageView.contentMode = UIViewContentModeScaleAspectFit; + _vipIconImageView.hidden = YES; + } + return _vipIconImageView; +} + +- (NetImageView *)experImageView { + if (!_experImageView) { + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserCardLevel; + _experImageView = [[NetImageView alloc] initWithConfig:config]; + _experImageView.userInteractionEnabled = YES; + _experImageView.hidden = YES; + _experImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _experImageView; +} + +- (NetImageView *)nameplateImageView_1 { + if (!_nameplateImageView_1) { + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserCardLevel; + _nameplateImageView_1 = [[NetImageView alloc] initWithConfig:config]; + _nameplateImageView_1.userInteractionEnabled = YES; + _nameplateImageView_1.contentMode = UIViewContentModeScaleAspectFit; + } + return _nameplateImageView_1; +} + +- (NetImageView *)nameplateImageView_2 { + if (!_nameplateImageView_2) { + NetImageConfig * config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeUserCardLevel; + _nameplateImageView_2 = [[NetImageView alloc] initWithConfig:config]; + _nameplateImageView_2.userInteractionEnabled = YES; + _nameplateImageView_2.contentMode = UIViewContentModeScaleAspectFit; + } + return _nameplateImageView_2; +} + +@end + +@interface UserRoomCardUserActionCell : UICollectionViewCell + +@property(nonatomic, strong) UserInfoModel *userInfo; +@property(nonatomic, copy) NSArray * models; +@property(nonatomic, strong) UIStackView *iconStack; +@property(nonatomic, copy) void(^handleTapIcon)(XPUserCardItemModel *model); + ++ (void)registerTo:(UICollectionView *)collectionView; ++ (UserRoomCardUserActionCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + models:(NSArray *)models + handleTapIcon:(void(^)(XPUserCardItemModel *model))tapIcon; + +@end + +@implementation UserRoomCardUserActionCell + ++ (void)registerTo:(UICollectionView *)collectionView { + [collectionView registerClass:[self class] + forCellWithReuseIdentifier:NSStringFromClass([self class])]; +} ++ (UserRoomCardUserActionCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + models:(NSArray *)models + handleTapIcon:(void(^)(XPUserCardItemModel *model))tapIcon { + UserRoomCardUserActionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class]) + forIndexPath:indexPath]; + [cell.contentView setBackgroundColor:[UIColor clearColor]]; + cell.userInfo = userInfo; + cell.models = models; + cell.handleTapIcon = tapIcon; + return cell; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self.contentView addSubview:self.iconStack]; + [self.iconStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.contentView); + make.width.lessThanOrEqualTo(self.contentView).offset(-30); + }]; + + UIView *line = [[UIView alloc] init]; + line.backgroundColor = UIColorFromRGB(0xe4e4e4); + [self.contentView addSubview:line]; + [line mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.bottom.mas_equalTo(self.contentView).offset(1); + make.width.mas_equalTo(self.contentView).offset(-30); + make.height.mas_equalTo(1); + }]; + } + return self; +} + +- (void)didTapIcon:(UIButton *)sender { + if (_handleTapIcon) { + self.handleTapIcon([self.models xpSafeObjectAtIndex:sender.tag]); + } +} + +- (void)setModels:(NSArray *)models { + _models = models; + for (UIView *subview in self.iconStack.arrangedSubviews) { + [self.iconStack removeArrangedSubview:subview]; + [subview removeFromSuperview]; + } + [models enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + dispatch_async(dispatch_get_main_queue(), ^{ + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.tag = idx; + if (obj.isSelect) { + [button setImage:kImage(obj.selectImageName) forState:UIControlStateNormal]; + } else { + [button setImage:kImage(obj.imageName) forState:UIControlStateNormal]; + } + [button addTarget:self action:@selector(didTapIcon:) forControlEvents:UIControlEventTouchUpInside]; + [self.iconStack addArrangedSubview:button]; + [button mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(50, 50)); + }]; + }); + }]; +} + +- (UIStackView *)iconStack { + if (!_iconStack) { + _iconStack = [[UIStackView alloc] init]; + _iconStack.alignment = UIStackViewAlignmentCenter; // 子视图在垂直方向居中 + _iconStack.distribution = UIStackViewDistributionEqualCentering; // 水平 + _iconStack.spacing = 12; + } + return _iconStack; +} + +@end + +@interface UserRoomCardMicActionCell : UICollectionViewCell + +@property(nonatomic, strong) UserInfoModel *userInfo; +@property(nonatomic, copy) NSArray *models; +@property(nonatomic, strong) UIStackView *iconStack; +@property(nonatomic, strong) UIButton *pickButton; +@property(nonatomic, copy) void(^handleTapIcon)(XPUserCardItemModel *model); +@property(nonatomic, copy) void(^handleTapPick)(void); + ++ (void)registerTo:(UICollectionView *)collectionView; ++ (UserRoomCardMicActionCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + models:(NSArray *)models + handleTapIcon:(void(^)(XPUserCardItemModel *model))tapIcon; + +- (void)dispplayPick; +@end + +@implementation UserRoomCardMicActionCell + + ++ (void)registerTo:(UICollectionView *)collectionView { + [collectionView registerClass:[self class] + forCellWithReuseIdentifier:NSStringFromClass([self class])]; +} ++ (UserRoomCardMicActionCell *)cellFor:(UICollectionView *)collectionView + indexPath:(NSIndexPath *)indexPath + userInfo:(UserInfoModel *)userInfo + models:(NSArray *)models + handleTapIcon:(void(^)(XPUserCardItemModel *model))tapIcon { + UserRoomCardMicActionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([self class]) + forIndexPath:indexPath]; + [cell.contentView setBackgroundColor:[UIColor clearColor]]; + [cell.contentView setCornerRadius:19 corners:UIRectCornerBottomLeft | UIRectCornerBottomRight]; + cell.userInfo = userInfo; + cell.models = models; + cell.handleTapIcon = tapIcon; + + return cell; +} + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self.contentView addSubview:self.iconStack]; + [self.iconStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.contentView).offset(10); + make.centerX.mas_equalTo(self.contentView); + make.width.lessThanOrEqualTo(self.contentView).offset(-30); + }]; + } + return self; +} + +- (void)dispplayPick { + [self.contentView addSubview:self.pickButton]; + [self.pickButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.iconStack.mas_bottom).offset(16); + make.leading.trailing.mas_equalTo(self.contentView).inset(kGetScaleWidth(80)); + make.height.mas_equalTo(36); + }]; +} + +- (void)setModels:(NSArray *)models { + _models = models; + for (UIView *subview in self.iconStack.arrangedSubviews) { + [self.iconStack removeArrangedSubview:subview]; + [subview removeFromSuperview]; + } + [models enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + dispatch_async(dispatch_get_main_queue(), ^{ + UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; + button.tag = idx; + if (obj.isSelect) { + [button setImage:kImage([obj selectImageName]) forState:UIControlStateNormal]; + } else { + [button setImage:kImage([obj imageName]) forState:UIControlStateNormal]; + } + [button addTarget:self action:@selector(didTapIcon:) forControlEvents:UIControlEventTouchUpInside]; + [self.iconStack addArrangedSubview:button]; + [button mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(38, 38)); + }]; + }); + }]; +} + +- (void)didTapIcon:(UIButton *)sender { + if (_handleTapIcon) { + self.handleTapIcon([self.models xpSafeObjectAtIndex:sender.tag]); + } +} + +- (void)didTapPick { + if (_handleTapPick) { + self.handleTapPick(); + } +} + +- (UIStackView *)iconStack { + if (!_iconStack) { + _iconStack = [[UIStackView alloc] init]; + _iconStack.alignment = UIStackViewAlignmentCenter; // 子视图在垂直方向居中 + _iconStack.distribution = UIStackViewDistributionEqualCentering; // 水平 + _iconStack.spacing = 12; + } + return _iconStack; +} + +- (UIButton *)pickButton { + if (!_pickButton) { + _pickButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_pickButton setCornerRadius:18 + cornerMask:kCALayerMaxXMaxYCorner | kCALayerMaxXMinYCorner | kCALayerMinXMaxYCorner | kCALayerMinXMinYCorner]; + [_pickButton addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xFF5778), + UIColorFromRGB(0xDB58FF), + ] + startPoint:CGPointMake(0, 0.5) + endPoint:CGPointMake(1, 0.5) + cornerRadius:18]; + [_pickButton setTitle:YMLocalizedString(@"1.0.31_text_3") forState:UIControlStateNormal]; + [_pickButton.titleLabel setFont:kFontMedium(14)]; + [_pickButton addTarget:self action:@selector(didTapPick) forControlEvents:UIControlEventTouchUpInside]; + } + return _pickButton; +} + +@end + +@interface UserRoomCardViewController () + +@property(nonatomic, assign) CGFloat collectionViewWidth; + +@property(nonatomic, strong) UserInfoModel *userInfoModel; +@property (nonatomic,strong) XPUserCardInfoModel *cardInfo; + +@property(nonatomic, strong) NetImageView *vipBGImageView; + +@property(nonatomic, strong) VAPView *topMP4View; +@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser; +@property(nonatomic, strong) UICollectionView *collectionView; + +@property (nonatomic,copy) NSArray *datasource; +@property(nonatomic, copy) NSArray *micActions; + +@end + +@implementation UserRoomCardViewController + +- (XPUserCardPresenter *)createPresenter { + return [[XPUserCardPresenter alloc] init]; +} + +- (instancetype)initWithUser:(XPUserCardInfoModel *)cardInfo { + if (self = [super init]) { + self.modalPresentationStyle = UIModalPresentationOverFullScreen; + self.cardInfo = cardInfo; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + self.datasource = @[]; + self.micActions = @[]; + [self setupUI]; + [self loadUserInfo]; + [self loadFunctionsItem]; +} + +#pragma mark - +- (void)setupUI { + self.view.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.3]; + + UIButton *dismissButton = [UIButton buttonWithType:UIButtonTypeCustom]; + dismissButton.frame = self.view.bounds; + [dismissButton addTarget:self + action:@selector(didTapEmptySpace) + forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:dismissButton]; + + + [self.view addSubview:self.collectionView]; +} + +- (void)loadUserInfo { + [self.presenter getUserInfo:self.cardInfo.uid]; +} + +- (void)loadFunctionsItem { + [self.presenter getFunctionItemsByUserInfo:self.cardInfo]; +} + +- (BOOL)configRoomDatingPickHeart { + return YES; + BOOL result = NO; + if (self.cardInfo.roomInfo.roomModeType == RoomModeType_Open_Blind && + self.cardInfo.roomInfo.blindDateState == RoomPlayDateingType_Pick && + [AccountInfoStorage instance].getUid.integerValue != self.cardInfo.uid.integerValue) { + __block MicroQueueModel * selfMicqueue; + __block MicroQueueModel * targetMicqueue; + [self.cardInfo.micQueue.allValues enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (obj.userInfo && obj.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) { + selfMicqueue = obj; + } else if(obj.userInfo && obj.userInfo.uid == self.cardInfo.uid.integerValue) { + targetMicqueue = obj; + } + }]; + if (selfMicqueue.userInfo && selfMicqueue.userInfo.uid > 0 && !selfMicqueue.userInfo.hasSelectUser && selfMicqueue.microState.position != -1 && targetMicqueue.microState.position != -1) { + result = YES; + } + } + + return result; +} + +#pragma mark - +- (void)didTapEmptySpace { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)handleTapItem:(XPUserCardItemModel *)item { + NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid]; + + switch (item.type) { + case UserCardMicroType_UpDown: + [self handleUpDown:item]; + break; + case UserCardMicroType_Lock: { + [self.presenter microLock:roomUid + state:item.status + position:self.cardInfo.position]; + } + break; + case UserCardMicroType_Mute: { + [self.presenter microMute:roomUid + state:item.status + position:self.cardInfo.position]; + } + break; + case UserCardMicroType_Clean_Gift_Value: { + [self.presenter cleanUserGiftValue:roomUid + micUid:self.cardInfo.uid]; + } + break; + case UserCardMicroType_Send_Gift: + case UserCardItemType_Gift: { + [self handleSendGift:item]; + break; + } + case UserCardItemType_Chat:{ + [self handleChat:item]; + } + break; + case UserCardItemType_Attention: { + [self.presenter attentionUser:self.cardInfo.uid + status:!item.isSelect]; + } + break; + case UserCardItemType_KickOut: { + [self handleKickOut:item]; + } + break; + case UserCardItemType_Black: { + [self handleBlackList:item]; + } + break; + case UserCardItemType_Manager: { + if ([self isSuperUser]) { + [self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"1" roomUid:roomUid isSet:!item.isSelect]; + } else { + [self.presenter makeUserManager:self.cardInfo.uid roomId:roomId enable:!item.isSelect]; + } + } + break; + case UserCardItemType_Invite_Micro: { + [self handleInviteMicro:item]; + } + break; + case UserCardItemType_AtUser: { + [self handleAtUser:item]; + } + default: + break; + } +} + +- (void)handleUpDown:(XPUserCardItemModel *)item { + // VIP 防 T 权限 + if (self.userInfoModel.userVipInfoVO.preventKick && + self.userInfoModel.uid != [AccountInfoStorage instance].getUid.integerValue) { + NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.userInfoModel.userVipInfoVO.vipLevel)]; + [XNDJTDDLoadingTool showErrorWithMessage:message]; + return; + } + + NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + + if (item.status) { + if ([self isInSudGame:self.cardInfo.uid]) { + if (self.cardInfo.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) { + [self showErrorToast:YMLocalizedString(@"XPUserCardViewController18")]; + [self dismissViewControllerAnimated:YES completion:nil]; + } else { + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.message = YMLocalizedString(@"XPUserCardViewController19"); + [TTPopup alertWithConfig:config confirmHandler:^{ + [self.presenter kickDownMicro:self.cardInfo.position roomId:roomId]; + } cancelHandler:^{ + }]; + } + return; + }else { + [self.presenter kickDownMicro:self.cardInfo.position roomId:roomId]; + } + } else { +// self.operaStackView.hidden = YES; + int micCount = (self.cardInfo.roomInfo.type == RoomType_Anchor) ? 4 : self.cardInfo.roomInfo.type == RoomType_MiniGame ? 6 : 9; + [self.presenter getRoomMicroItems:micCount cardInfo:self.cardInfo]; + } +} + +- (void)handleSendGift:(XPUserCardItemModel *)item { + [self dismissViewControllerAnimated:NO completion:nil]; + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid]; + XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid]; + giftView.delegate = self.cardInfo.delegate; + NSArray *users = [self configGiftUsers:self.cardInfo.delegate.getMicroQueue]; + [giftView configGiftUsers:users]; + [self.presentingViewController presentViewController:giftView animated:YES completion:nil]; +} + +- (void)handleChat:(XPUserCardItemModel *)item { +// if(self.delegate && [self.delegate respondsToSelector:@selector(clickChatAction)]){ +// [self.delegate clickChatAction]; +// } + [self.presentingViewController.navigationController popViewControllerAnimated:YES]; + [self dismissViewControllerAnimated:YES completion:^{ + UIViewController * controller = (UIViewController *)self.cardInfo.delegate; + XPRoomHalfMessageView *halfMessageView = [[XPRoomHalfMessageView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight) controller:controller]; + halfMessageView.chatUserId = self.cardInfo.uid; + [controller.view addSubview:halfMessageView]; + [UIView animateWithDuration:.35 animations:^{ + CGRect rect = halfMessageView.frame; + rect.origin.y = 0; + halfMessageView.frame = rect; + }]; + }]; +} + +- (void)handleKickOut:(XPUserCardItemModel *)item { + if (self.userInfoModel.userVipInfoVO.preventKick && + self.userInfoModel.uid != [AccountInfoStorage instance].getUid.integerValue) { + NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.userInfoModel.userVipInfoVO.vipLevel)]; + [TTPopup alertWithMessage:message confirmHandler:^{ + } cancelHandler:^{ + }]; + } else { + NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + if ([self isInSudGame:self.cardInfo.uid]) { + NSString *message = YMLocalizedString(@"XPUserCardViewController8"); + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.title = @""; + config.message = message; + [TTPopup alertWithConfig:config confirmHandler:^{ + if ([self isSuperUser]) { + [self.presenter superAdminKickUser:self.userInfoModel.nick cardInfo:self.cardInfo]; + } else { + [self.presenter makeKickUser:self.cardInfo.uid roomId:roomId]; + } + } cancelHandler:^{ + }]; + } else { + NSString *message = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController9"),self.userInfoModel.nick]; + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.title = YMLocalizedString(@"XPUserCardViewController10"); + config.message = message; + [TTPopup alertWithConfig:config confirmHandler:^{ + if ([self isSuperUser]) { + [self.presenter superAdminKickUser:self.userInfoModel.nick cardInfo:self.cardInfo]; + } else { + [self.presenter makeKickUser:self.cardInfo.uid roomId:roomId]; + } + } cancelHandler:^{ + }]; + } + } +} + +- (void)handleBlackList:(XPUserCardItemModel *)item { + if (self.userInfoModel.userVipInfoVO.preventKick && + self.userInfoModel.uid != [AccountInfoStorage instance].getUid.integerValue) { + NSString *message = [NSString stringWithFormat:YMLocalizedString(@"UserCard_1.0.17_0"), @(self.userInfoModel.userVipInfoVO.vipLevel)]; + [TTPopup alertWithMessage:message confirmHandler:^{ + } cancelHandler:^{ + }]; + } else { + NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.uid]; + if ([self isInSudGame:self.cardInfo.uid]) { + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.title = @""; + config.message = [NSString stringWithFormat: YMLocalizedString(@"XPUserCardViewController14"), self.userInfoModel.nick]; + [TTPopup alertWithConfig:config confirmHandler:^{ + if ([self isSuperUser]) { + [self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"-1" roomUid:roomUid isSet:YES]; + } else { + [self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId]; + } + } cancelHandler:^{ + }]; + } else { + NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPUserCardViewController15"),self.userInfoModel.nick]; + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.title = title; + config.message = YMLocalizedString(@"XPUserCardViewController16"); + [TTPopup alertWithConfig:config confirmHandler:^{ + if ([self isSuperUser]) { + [self.presenter superAdminHandleUser:self.cardInfo.uid opt:@"-1" roomUid:roomUid isSet:YES]; + }else { + [self.presenter makeUserBlack:self.cardInfo.uid roomId:roomId]; + } + } cancelHandler:^{ + }]; + } + } +} + +- (void)handleInviteMicro:(XPUserCardItemModel *)item { + NSString * roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + if ([AccountInfoStorage instance].getUid.integerValue == self.userInfoModel.uid) { + [self.presenter upMicro:roomId position:item.position userInfo:self.userInfoModel]; + } else { + if (self.cardInfo.roomInfo.leaveMode && + [item.position isEqualToString:@"-1"]) { + return; + } + + NSMutableDictionary * dic = [NSMutableDictionary dictionary]; + [dic setValue:@(item.position.integerValue) forKey:@"micPosition"]; + [dic setValue:@(self.userInfoModel.uid) forKey:@"uid"]; + AttachmentModel *attachement = [[AttachmentModel alloc]init]; + attachement.first = CustomMessageType_Queue; + attachement.second = Custom_Message_Sub_Queue_Invite; + attachement.data = dic; + + NIMMessage *message = [[NIMMessage alloc]init]; + NIMCustomObject *object = [[NIMCustomObject alloc] init]; + object.attachment = attachement; + message.messageObject = object; + //构造会话 + NIMSession *session = [NIMSession session:roomId type:NIMSessionTypeChatroom]; + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil]; + [self dismissViewControllerAnimated:YES completion:nil]; + } +} + +- (void)handleAtUser:(XPUserCardItemModel *)item { + [self.presentingViewController.navigationController popViewControllerAnimated:YES]; + if (self.cardInfo.roomInfo.isCloseScreen) { + [self showErrorToast:YMLocalizedString(@"XPUserCardViewController17")]; + return; + } + [self dismissViewControllerAnimated:NO completion:^{ + UIViewController *vc = self.cardInfo.delegate.getCurrentNav.viewControllers[0]; + [XPRoomSendTextView showTextView:vc.view + delegate:self.cardInfo.delegate + atUid:self.cardInfo.uid + atNick:self.userInfoModel.nick]; + }]; +} + +- (BOOL)isInSudGame:(NSString *)uid { + BOOL isGamePlaying = NO; + if (self.cardInfo.roomInfo.type == RoomType_MiniGame) { + for (int i = -1; i<5; i++) { + NSMutableDictionary * micQueue = self.cardInfo.micQueue; + MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]]; + if (micSequence == nil || micSequence.userInfo == nil) { + continue; + } + if (micSequence.userInfo.uid == uid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) { + isGamePlaying = YES; + break; + } + } + } + return isGamePlaying; +} + +- (BOOL)isSuperUser { + BOOL meIsSuperAdmin = NO; + for (GuildSuperAdminInfoModel *managerInfo in self.cardInfo.superMangerList) { + if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) { + meIsSuperAdmin = YES; + } + } + return meIsSuperAdmin; +} + +- (NSArray *)configGiftUsers:(NSMutableDictionary *)queue { + NSMutableArray * array = [NSMutableArray array]; + BOOL receiveIsOnMic = NO; + for (MicroQueueModel * microModel in queue.allValues) { + if (microModel.userInfo && microModel.userInfo.uid >0) { + UserInfoModel * userInfo = microModel.userInfo; + if (userInfo.uid == self.cardInfo.uid.integerValue) { + receiveIsOnMic = YES; + } + } + } + if (receiveIsOnMic) { + for (MicroQueueModel * microModel in queue.allValues) { + if (microModel.userInfo && microModel.userInfo.uid >0) { + UserInfoModel * userInfo = microModel.userInfo; + XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; + userModel.avatar = userInfo.avatar; + userModel.vipMic = userInfo.vipMic; + userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position]; + userModel.uid = userInfo.uid; + if (userInfo.uid == self.cardInfo.uid.integerValue) { + userModel.isSelect = YES; + } + if (self.cardInfo.roomInfo.type == RoomType_Anchor && microModel.microState.position == -1) {///个播房一直为离开模式,不需要添加房主位 + continue; + } + [array addObject:userModel]; + } + } + + RoomInfoModel * roomInfo = self.cardInfo.roomInfo; + if (roomInfo.leaveMode) { + XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; + userModel.avatar = roomInfo.avatar; + userModel.position = @"-1"; + userModel.uid = self.cardInfo.uid.integerValue; + if (roomInfo.uid == self.cardInfo.uid.integerValue) { + userModel.isSelect = YES; + } + [array addObject:userModel]; + } else if (roomInfo.type == RoomType_Anchor) { + BOOL hadContainerOwner = NO; + for (UserInfoModel *userModel in array) { + if (userModel.uid == roomInfo.uid) { + hadContainerOwner = YES; + break; + } + } + if (!hadContainerOwner) { + XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; + userModel.avatar = roomInfo.avatar; + userModel.position = @"-1"; + userModel.uid = self.cardInfo.uid.integerValue; + if (roomInfo.uid == self.cardInfo.uid.integerValue) { + userModel.isSelect = YES; + } + [array addObject:userModel]; + } + } + } else { + XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init]; + userModel.avatar = self.userInfoModel.avatar; + userModel.nick = self.userInfoModel.nick; + userModel.uid = self.cardInfo.uid.integerValue; + userModel.isSelect = YES; + [array addObject:userModel]; + } + return array; +} + +#pragma mark - +- (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo { + self.userInfoModel = userInfo; + [self.collectionView reloadData]; + + // TODO: 头像摆出来,在 z 轴最上层 + // TODO: 计算高度 + // TODO: 减少 reload 闪烁 + + if (userInfo.userVipInfoVO.vipLevel>0 && userInfo.userVipInfoVO.userCardBG.length > 0) { + [self.view insertSubview:self.vipBGImageView atIndex:0]; + [self.vipBGImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.collectionView); + make.height.mas_equalTo(300); + }]; + self.vipBGImageView.imageUrl = [userInfo.userVipInfoVO.userCardBG stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; + } + + if (userInfo.infoCardVo) { + [self.view addSubview:self.topMP4View]; + [self.topMP4View mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(self.view).inset(-34); + make.bottom.mas_equalTo(self.collectionView.mas_top).offset(160); + make.height.mas_equalTo(300); + }]; + + switch (userInfo.infoCardVo.effectType) { + case 0: + // 图片 +// self.nobleImageView.imageUrl = userInfo.infoCardVo.effect; + break; + case 1: { + NSString *resourcePath = [userInfo.infoCardVo.effect pureURLString]; + if (resourcePath.length > 0) { + @kWeakify(self); + [self.vapParser parseWithURL:resourcePath + completionBlock:^(NSString * _Nullable videoUrl) { + @kStrongify(self); + if (videoUrl.length) { + [self.topMP4View setMute:YES]; + [self.topMP4View playHWDMP4:videoUrl repeatCount:-1 delegate:nil]; + } + } failureBlock:^(NSError * _Nullable error) { + }]; + } + } + break; + default: + break; + } + } +} + +- (void)onGetFunctionArraySccess:(NSArray *)array { + NSMutableArray *temp_1 = @[].mutableCopy; + if (array.count <= 0) { + if([ [AccountInfoStorage instance].getUid isEqualToString:self.cardInfo.uid] ){ + XPUserCardItemModel *cardModel = [XPUserCardItemModel new]; + cardModel.type = UserCardMicroType_Send_Gift; + cardModel.title = YMLocalizedString(@"XPUserCardPresenter13"); + cardModel.imageName = @"room_user_card_send_gift"; + cardModel.selectImageName = @"room_user_card_send_gift"; + [temp_1 insertObject:cardModel atIndex:0]; + } + self.datasource = temp_1.copy; + [self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo]; + } else { + NSMutableArray *temp_2 = @[].mutableCopy; + for (XPUserCardItemModel *model in array) { + if (model.type == UserCardItemType_Gift || + model.type == UserCardItemType_Chat || + model.type == UserCardItemType_AtUser || + model.type == UserCardItemType_Attention) { + [temp_1 addObject:model]; + } else { + [temp_2 addObject:model]; + } + } + self.datasource = temp_1.copy; + self.micActions = temp_2.copy; + [self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo]; + } + [self.collectionView reloadData]; +} + +- (void)onGetMicroFunctionArraySuccess:(NSArray *)array { + if (array.count <= 0) { + + } else { + NSMutableArray *temp = [self.micActions mutableCopy]; + for (XPUserCardMicroItemModel *model in array) { + [temp addObject:[self transModelFrom:model]]; + } + self.micActions = temp; + } + + [self.collectionView reloadData]; +} + +-(void)onGetFollowDataSccess{ + [self.collectionView reloadData]; +} + +- (XPUserCardItemModel *)transModelFrom:(XPUserCardMicroItemModel *)model { + XPUserCardItemModel *cardModel = [XPUserCardItemModel new]; + cardModel.uid = model.uid; + cardModel.type = model.type; + cardModel.title = model.title; + cardModel.status = model.status; + cardModel.imageName = model.iconImage; + return cardModel; +} + +- (void)attentionUserSuccess:(XPUserCardItemModel *)item { + [self.micActions enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (item.type == obj.type) { + obj.isSelect = item.isSelect; + *stop = YES; + } + }]; + [self.collectionView reloadData]; +} + +- (void)markUserManagerFinish:(XPUserCardItemModel *)item error:(NSError *)error { + if (error == nil) { + [self.micActions enumerateObjectsUsingBlock:^(XPUserCardItemModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (item.type == obj.type) { + obj.isSelect = item.isSelect; + *stop = YES; + } + }]; + [self.collectionView reloadData]; + } +} + +- (void)makeKickUserFinish:(NSError *)error { + if (error == nil && self.userInfoModel) { + [self dismissViewControllerAnimated:YES completion:nil]; + [self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BeKicked]; + } else if (error.code == 404) { + [self showErrorToast:YMLocalizedString(@"XPUserCardViewController1")]; + } +} + +- (void)superAdminKickUserFinish:(NSError *)error { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)lockMicroSusccess { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)muteMicroSusccess { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)kickDownMicroSuccess { + if (self.cardInfo.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) { + [self sendCustomMessageKickOrBlackUser:CustomMessageType_Queue second:Custom_Message_Sub_Queue_Kick]; + } + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)upMicroSuccess { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)cleanUserGiftValueSuccess:(NSDictionary *)dic { + [self showSuccessToast:YMLocalizedString(@"XPUserCardViewController3")]; + NIMMessage * message = [[NIMMessage alloc] init]; + AttachmentModel * attachMent = [[AttachmentModel alloc] init]; + attachMent.first = CustomMessageType_Room_GiftValue; + attachMent.second = Custom_Message_Sub_Room_GiftValue_Sync; + attachMent.data = dic; + NIMCustomObject *object = [[NIMCustomObject alloc] init]; + object.attachment = attachMent; + message.messageObject = object; + //构造会话 + NSString * sessionId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil]; + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)roomDatingPickHeartUserSuccess { + [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)makeUserBlackFinish:(NSError *)error { + if (error == nil && self.userInfoModel) { + [self dismissViewControllerAnimated:YES completion:nil]; + if (self.cardInfo.position.length > 0) { + NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc]init]; + request.key = self.cardInfo.position; + request.roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + [[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary * _Nullable element) { + if (error == nil ) { + } + }]; + } + [self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BlackList]; + } else if (error.code == 417) { + [self showErrorToast:YMLocalizedString(@"XPUserCardViewController2")]; + } +} + +- (void)superAdminHandleUserSuccess:(NSString *)opt { + [self showSuccessToast:YMLocalizedString(@"XPUserCardViewController4")]; + [self dismissViewControllerAnimated:YES completion:nil]; + if ([opt isEqualToString:@"-1"]) {///拉黑 + if (self.cardInfo.position.length > 0) { + NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc]init]; + request.key = self.cardInfo.position; + request.roomId = [NSString stringWithFormat:@"%ld", self.cardInfo.roomInfo.roomId]; + [[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary * _Nullable element) { + if (error == nil ) { + } + }]; + } + [self sendCustomMessageKickOrBlackUser:CustomMessageType_Kick_User second:Custom_Message_Sub_Kick_BlackList]; + } +} + +///拉黑/踢出房间 发送自定义消息 +- (void)sendCustomMessageKickOrBlackUser:(int)first second:(int)second { + RoomInfoModel * roomInfo = self.cardInfo.roomInfo; + XPKickUserModel *notifyModel = [[XPKickUserModel alloc] init]; + notifyModel.handleNick = self.cardInfo.nick; + notifyModel.handleUid = [AccountInfoStorage instance].getUid.integerValue; + notifyModel.targetUid = self.cardInfo.uid.integerValue; + notifyModel.targetNick = self.userInfoModel.nick; + notifyModel.uid = self.cardInfo.uid.integerValue; + AttachmentModel *attachment = [[AttachmentModel alloc] init]; + attachment.first = first; + attachment.second = second; + attachment.data = [notifyModel model2dictionary]; + NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; + + NIMMessage *message = [[NIMMessage alloc]init]; + NIMCustomObject *object = [[NIMCustomObject alloc] init]; + object.attachment = attachment; + message.messageObject = object; + //构造会话 + NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; + [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil]; +} + +#pragma mark - +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return 4; +} + +- (CGSize)collectionView:(UICollectionView *)collectionView + layout:(UICollectionViewLayout *)collectionViewLayout + sizeForItemAtIndexPath:(NSIndexPath *)indexPath { + switch (indexPath.row) { + case 0: + return CGSizeMake(self.collectionViewWidth, 120); + break; + case 1: + return CGSizeMake(self.collectionViewWidth, 30); + break; + case 2: + return CGSizeMake(self.collectionViewWidth, 60); + break; + case 3: + return CGSizeMake(self.collectionViewWidth, 38 + 16 + 12 + ([self configRoomDatingPickHeart] ? 36 + 32 : 0)); + break; + default: + return CGSizeZero; + break; + } +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + switch (indexPath.row) { + case 0: { + UserRoomCardInfoCell *cell = [UserRoomCardInfoCell cellFor:collectionView + indexPath:indexPath + userInfo:self.userInfoModel + handleTapReport:^{ + + } + handleTapAvatar:^{ + + }]; + return cell; + } + break; + case 1: { + UserRoomCardNameplateCell *cell = [UserRoomCardNameplateCell cellFor:collectionView + indexPath:indexPath + userInfo:self.userInfoModel]; + return cell; + } + break; + case 2: { + @kWeakify(self); + UserRoomCardUserActionCell *cell = [UserRoomCardUserActionCell cellFor:collectionView + indexPath:indexPath + userInfo:self.userInfoModel + models:self.datasource + handleTapIcon:^(XPUserCardItemModel *model) { + @kStrongify(self); + [self handleTapItem:model]; + }]; + return cell; + } + break; + case 3: { + @kWeakify(self); + UserRoomCardMicActionCell *cell = [UserRoomCardMicActionCell cellFor:collectionView + indexPath:indexPath + userInfo:self.userInfoModel + models:self.micActions + handleTapIcon:^(XPUserCardItemModel *model) { + @kStrongify(self); + [self handleTapItem:model]; + }]; + if ([self configRoomDatingPickHeart]) { + [cell dispplayPick]; + } + return cell; + } + break; + default: { + UICollectionViewCell *cell = [UICollectionViewCell new]; + return cell; + } + break; + } +} + + +#pragma mark - +- (UICollectionView *)collectionView { + if (!_collectionView) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumLineSpacing = 0; + layout.minimumInteritemSpacing = 0; +// CGFloat space = kGetScaleWidth(45); + CGFloat space_top = kGetScaleWidth(300); + self.collectionViewWidth = KScreenWidth; + _collectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(0, + space_top, + KScreenWidth, + KScreenHeight-space_top) + collectionViewLayout:layout]; + [_collectionView setCornerRadius:16]; + _collectionView.backgroundColor = [UIColor clearColor]; + _collectionView.delegate = self; + _collectionView.dataSource = self; + _collectionView.clipsToBounds = NO; + [UserRoomCardInfoCell registerTo:_collectionView]; + [UserRoomCardNameplateCell registerTo:_collectionView]; + [UserRoomCardUserActionCell registerTo:_collectionView]; + [UserRoomCardMicActionCell registerTo:_collectionView]; + } + return _collectionView; +} + +- (VAPView *)topMP4View { + if (!_topMP4View) { + _topMP4View = [[VAPView alloc] init]; + _topMP4View.contentMode = UIViewContentModeScaleAspectFill; + _topMP4View.userInteractionEnabled = NO; + } + return _topMP4View; +} + +- (XPRoomGiftAnimationParser *)vapParser { + if (!_vapParser) { + _vapParser = [[XPRoomGiftAnimationParser alloc] init]; + } + return _vapParser; +} + +- (NetImageView *)vipBGImageView { + if (!_vipBGImageView) { + _vipBGImageView = [[NetImageView alloc] init]; + _vipBGImageView.contentMode = UIViewContentModeScaleAspectFill; + _vipBGImageView.clipsToBounds = YES; + [_vipBGImageView setCornerRadius:16 cornerMask:kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner]; + } + return _vipBGImageView; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/XPRoomViewController.m b/YuMi/Modules/YMRoom/View/XPRoomViewController.m index 030efad8..9f6655ed 100644 --- a/YuMi/Modules/YMRoom/View/XPRoomViewController.m +++ b/YuMi/Modules/YMRoom/View/XPRoomViewController.m @@ -50,6 +50,8 @@ #import "SocialStageView.h" #import "TenMicStageView.h" #import "FifteenMicStageView.h" +#import "NineteenMicStageView.h" +#import "TwentyMicStageView.h" #import "DatingStageView.h" #import "AnchorStageView.h" #import "AnchorPkStageView.h" @@ -130,6 +132,8 @@ XPCandyTreeInsufficientBalanceViewDelegate> @property (nonatomic,strong) StageView *stageView; @property (nonatomic,strong) TenMicStageView *tenMicStageView; @property (nonatomic,strong) FifteenMicStageView *fifteenMicStageView; +@property (nonatomic,strong) TwentyMicStageView *twentyMicStageView; +@property(nonatomic, strong) NineteenMicStageView *nineteenMicStageView; ///公屏 @property (nonatomic,strong) MsRoomMessageMainView *messageContainerView; ///快捷发言 @@ -539,6 +543,14 @@ XPCandyTreeInsufficientBalanceViewDelegate> [self.view addSubview:self.animationView]; } +- (void)__layoutTwentyMicStage { + [self.stageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(self.view); + make.top.mas_equalTo(self.roomHeaderView.mas_bottom); + make.height.mas_equalTo(self.stageView.hightForStageView); + }]; +} + - (void)__layoutFifteenMicStage { [self.stageView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.mas_equalTo(self.view); @@ -829,7 +841,12 @@ XPCandyTreeInsufficientBalanceViewDelegate> } else if (roomInfo.type == RoomType_MiniGame) { return [LittleGameScrollStageView class]; } else if (roomInfo.type == RoomType_15Mic) { +#if DEBUG + return [NineteenMicStageView class]; +// return [TwentyMicStageView class]; +#endif return [FifteenMicStageView class]; + } else if (roomInfo.type == RoomType_10Mic) { return [TenMicStageView class]; } else if (roomInfo.hadChangeRoomType && ![self.stageView isKindOfClass:[SocialStageView class]]) { @@ -877,7 +894,6 @@ XPCandyTreeInsufficientBalanceViewDelegate> }]; [self.activityContainerView mas_remakeConstraints:^(MASConstraintMaker *make) { -// make.height.mas_equalTo(115); make.trailing.mas_equalTo(self.view); make.bottom.mas_equalTo(self.quickMessageContainerView.mas_top).offset(-5); make.width.mas_equalTo(87); @@ -1863,7 +1879,12 @@ XPCandyTreeInsufficientBalanceViewDelegate> } else if (self.roomInfo.type == RoomType_15Mic) { [self __layoutFifteenMicStage]; [self changeStageViewOnRoomUpdate]; +#if DEBUG +// [self.twentyMicStageView onRoomUpdate]; + [self.nineteenMicStageView onRoomUpdate]; +#else [self.fifteenMicStageView onRoomUpdate]; +#endif } else if (self.roomInfo.type == RoomType_10Mic) { [self __layoutTenMicStage]; [self changeStageViewOnRoomUpdate]; @@ -2730,6 +2751,20 @@ XPCandyTreeInsufficientBalanceViewDelegate> return _tenMicStageView; } +- (NineteenMicStageView *)nineteenMicStageView { + if (!_nineteenMicStageView) { + _nineteenMicStageView = [[NineteenMicStageView alloc] initWithDelegate:self]; + } + return _nineteenMicStageView; +} + +- (TwentyMicStageView *)twentyMicStageView { + if (!_twentyMicStageView) { + _twentyMicStageView = [[TwentyMicStageView alloc] initWithDelegate:self]; + } + return _twentyMicStageView; +} + - (FifteenMicStageView *)fifteenMicStageView { if (!_fifteenMicStageView) { _fifteenMicStageView = [[FifteenMicStageView alloc] initWithDelegate:self]; diff --git a/YuMi/Structure/MVP/Model/UserInfoModel.h b/YuMi/Structure/MVP/Model/UserInfoModel.h index 993515e8..e5dc77df 100644 --- a/YuMi/Structure/MVP/Model/UserInfoModel.h +++ b/YuMi/Structure/MVP/Model/UserInfoModel.h @@ -195,6 +195,8 @@ NS_ASSUME_NONNULL_BEGIN /// 是否超管身份 @property(nonatomic, assign) BOOL hasSuperRole; +@property(nonatomic, copy) NSString *guildNameplateIcon; + - (BOOL)isUserValid; - (NSString *)userIDString; diff --git a/YuMi/Tools/IAPHelper/RechargeStorage.m b/YuMi/Tools/IAPHelper/RechargeStorage.m index 16646d29..e3ffd8b6 100644 --- a/YuMi/Tools/IAPHelper/RechargeStorage.m +++ b/YuMi/Tools/IAPHelper/RechargeStorage.m @@ -7,7 +7,7 @@ #import "RechargeStorage.h" #import - + #define kAppStoreKey @"kAppStoreKey" static diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index b2232938..61b5fc0d 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -4030,3 +4030,8 @@ ineHeadView12" = "الحمل"; "1.0.30_text_29" = "سبب الحظر"; "1.0.30_text_30" = "يرجى إدخال سبب الحظر، والذي سيكون مرئيًا في الخلفية"; "1.0.30_text_31" = "حظر"; + +"1.0.31_text_0" = "Country/Region"; +"1.0.31_text_1" = "Select Country/Region"; +"1.0.31_text_2" = "Country/Region List"; +"1.0.31_text_3" = "Selective cardiography"; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index 5ca7a746..de1d5867 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -3824,3 +3824,8 @@ "1.0.30_text_30" = "Please enter the block reason, which will be visible in the background"; "1.0.30_text_31" = "Block"; +"1.0.31_text_0" = "Country/Region"; +"1.0.31_text_1" = "Select Country/Region"; +"1.0.31_text_2" = "Country/Region List"; +"1.0.31_text_3" = "Selective cardiography"; + diff --git a/YuMi/tr.lproj/Localizable.strings b/YuMi/tr.lproj/Localizable.strings index bfdb5508..41101bfd 100644 --- a/YuMi/tr.lproj/Localizable.strings +++ b/YuMi/tr.lproj/Localizable.strings @@ -307,7 +307,7 @@ "XPMineNewUserRechargeView2" = "%zd saat %zd dakika"; "XPMineNewUserRechargeView3" = "%zd dakika"; -"XPMineAccountView0" = "Altın Bakiyesi"; +"XPMineAccountView0" = "Jeton bakiyesi"; "XPMineVerifIdentityView0" = "Doğrulama Kodu Gönder"; @@ -3609,3 +3609,8 @@ "1.0.30_text_29" = "Engellenme nedeni"; "1.0.30_text_30" = "Lütfen arka planda görünecek olan engelleme nedenini girin"; "1.0.30_text_31" = "Engelleme"; + +"1.0.31_text_0" = "Country/Region"; +"1.0.31_text_1" = "Select Country/Region"; +"1.0.31_text_2" = "Country/Region List"; +"1.0.31_text_3" = "Selective cardiography"; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index 1d4bc99e..8a87ab33 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -3481,3 +3481,8 @@ "1.0.30_text_29" = "封禁原因"; "1.0.30_text_30" = "请输入封禁原因,该原因将在后台可见"; "1.0.30_text_31" = "封禁"; + +"1.0.31_text_0" = "Country/Region"; +"1.0.31_text_1" = "Select Country/Region"; +"1.0.31_text_2" = "Country/Region List"; +"1.0.31_text_3" = "Selective cardiography";