diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 87889b79..ff086699 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -492,6 +492,11 @@ 23FF42762AA6E1480055733C /* XPHomeRecommendOtherRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42752AA6E1480055733C /* XPHomeRecommendOtherRoomView.m */; }; 23FF42792AA6E19C0055733C /* HomeMenuSourceModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */; }; 23FF428E2AAB2D3A0055733C /* XPCandyTreeBuyView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */; }; + 4C1392932D6D963700A6DFB5 /* SubRechargersViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392922D6D963600A6DFB5 /* SubRechargersViewController.m */; }; + 4C1392962D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392952D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m */; }; + 4C1392992D6DB4CD00A6DFB5 /* MoliMoneyLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1392982D6DB4CD00A6DFB5 /* MoliMoneyLabel.m */; }; + 4C13929D2D70441500A6DFB5 /* giftgift.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 4C13929B2D70441500A6DFB5 /* giftgift.mp4 */; }; + 4C1392A12D71675900A6DFB5 /* coincoin.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 4C1392A02D71675900A6DFB5 /* coincoin.mp4 */; }; 4C1892992CF84349004D4426 /* RoomCahtCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C1892982CF84349004D4426 /* RoomCahtCell.m */; }; 4C44BD5D2D151B5C00F321FA /* RoomSideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */; }; 4C4707A52D53430300C8CD24 /* NSData+GZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4707A42D53430300C8CD24 /* NSData+GZIP.m */; }; @@ -506,13 +511,26 @@ 4C6E31EE2D363CA800D8EEDD /* addMoveAnimationToView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C6E31ED2D363CA800D8EEDD /* addMoveAnimationToView.m */; }; 4C71C69F2D069D2B00ECCA24 /* GiftAnimationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C71C69E2D069D2B00ECCA24 /* GiftAnimationHelper.m */; }; 4C71C6A22D06DB3D00ECCA24 /* GiftAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C71C6A12D06DB3D00ECCA24 /* GiftAnimationManager.m */; }; + 4C75CEFB2D6318FF009147A5 /* RoomEnterModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C75CEFA2D6318FF009147A5 /* RoomEnterModel.m */; }; + 4C75CEFE2D632CD5009147A5 /* CPEnterRoomTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C75CEFD2D632CD5009147A5 /* CPEnterRoomTableViewCell.m */; }; + 4C75CF002D633C27009147A5 /* CP进场.svga in Resources */ = {isa = PBXBuildFile; fileRef = 4C75CEFF2D633C27009147A5 /* CP进场.svga */; }; 4C7989EC2D19392E006AE07B /* EmptyDataView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7989EB2D19392E006AE07B /* EmptyDataView.m */; }; 4C7989EF2D195277006AE07B /* RoomModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7989EE2D195277006AE07B /* RoomModeViewController.m */; }; 4C7989F32D1952DA006AE07B /* RoomModePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C7989F22D1952DA006AE07B /* RoomModePresenter.m */; }; 4C815A172CFEB758002A46A6 /* SuperBlockViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C815A162CFEB758002A46A6 /* SuperBlockViewController.m */; }; + 4C864A022D55F4F600191AE0 /* LuckyPackagePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C864A012D55F4F600191AE0 /* LuckyPackagePresenter.m */; }; + 4C864A052D561E1D00191AE0 /* LuckyPackageLogicManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C864A042D561E1D00191AE0 /* LuckyPackageLogicManager.m */; }; + 4CA532B42D5AEE9400B8F59F /* Api+LuckyPackage.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532B32D5AEE9400B8F59F /* Api+LuckyPackage.m */; }; + 4CA532B72D5B333200B8F59F /* RoomLuckyPackageInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532B62D5B333200B8F59F /* RoomLuckyPackageInfoModel.m */; }; + 4CA532BA2D5C8EBE00B8F59F /* LuckyPackageBannerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532B92D5C8EBE00B8F59F /* LuckyPackageBannerView.m */; }; + 4CA532BD2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532BC2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.m */; }; + 4CA532C02D5CA4D300B8F59F /* LuckyPackageStatusView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532BF2D5CA4D300B8F59F /* LuckyPackageStatusView.m */; }; + 4CA532C32D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CA532C22D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.m */; }; 4CB753D22D30F10900B13DF5 /* LuckyPackageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CB753D12D30F10900B13DF5 /* LuckyPackageViewController.m */; }; 4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; }; 4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; }; + 4CD6FF662D673A5C00262AB7 /* AgentMessageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD6FF652D673A5C00262AB7 /* AgentMessageModel.m */; }; + 4CD6FF692D673F7F00262AB7 /* AgentMessageTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD6FF682D673F7F00262AB7 /* AgentMessageTableViewCell.m */; }; 4CE3A9462D22754C003F0796 /* RechargeUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE3A9452D22754C003F0796 /* RechargeUserModel.m */; }; 4CEB9EA72D09643E00443480 /* UserRoomCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA62D09643E00443480 /* UserRoomCardViewController.m */; }; 4CEB9EAA2D097E8400443480 /* MoliAvatar.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CEB9EA92D097E8400443480 /* MoliAvatar.m */; }; @@ -1074,7 +1092,6 @@ E83645A82A40AF5400E0DBE4 /* NSBundle+Localizable.m in Sources */ = {isa = PBXBuildFile; fileRef = E83645A72A40AF5400E0DBE4 /* NSBundle+Localizable.m */; }; E8383697298A598D00112E1C /* MessageTipsModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E8383696298A598D00112E1C /* MessageTipsModel.m */; }; E838369A298A59C100112E1C /* MessageTipsView.m in Sources */ = {isa = PBXBuildFile; fileRef = E8383699298A59C100112E1C /* MessageTipsView.m */; }; - E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */; }; E839532D276A030F00CF2F24 /* XPMineDressUpListViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E839532C276A030F00CF2F24 /* XPMineDressUpListViewController.m */; }; E8395331276A03AE00CF2F24 /* Api+DressUp.m in Sources */ = {isa = PBXBuildFile; fileRef = E8395330276A03AE00CF2F24 /* Api+DressUp.m */; }; E8395334276A03C300CF2F24 /* XPMineDressUpPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E8395333276A03C300CF2F24 /* XPMineDressUpPresenter.m */; }; @@ -2589,6 +2606,14 @@ 23FF42782AA6E19C0055733C /* HomeMenuSourceModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeMenuSourceModel.m; sourceTree = ""; }; 23FF428C2AAB2D3A0055733C /* XPCandyTreeBuyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPCandyTreeBuyView.h; sourceTree = ""; }; 23FF428D2AAB2D3A0055733C /* XPCandyTreeBuyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPCandyTreeBuyView.m; sourceTree = ""; }; + 4C1392912D6D963600A6DFB5 /* SubRechargersViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SubRechargersViewController.h; sourceTree = ""; }; + 4C1392922D6D963600A6DFB5 /* SubRechargersViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SubRechargersViewController.m; sourceTree = ""; }; + 4C1392942D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RechargerTransferHistoryViewController.h; sourceTree = ""; }; + 4C1392952D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RechargerTransferHistoryViewController.m; sourceTree = ""; }; + 4C1392972D6DB4CD00A6DFB5 /* MoliMoneyLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoliMoneyLabel.h; sourceTree = ""; }; + 4C1392982D6DB4CD00A6DFB5 /* MoliMoneyLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MoliMoneyLabel.m; sourceTree = ""; }; + 4C13929B2D70441500A6DFB5 /* giftgift.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = giftgift.mp4; sourceTree = ""; }; + 4C1392A02D71675900A6DFB5 /* coincoin.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = coincoin.mp4; 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 = ""; }; 4C44BD5B2D151B5C00F321FA /* RoomSideMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomSideMenu.h; sourceTree = ""; }; @@ -2616,6 +2641,11 @@ 4C71C69E2D069D2B00ECCA24 /* GiftAnimationHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftAnimationHelper.m; sourceTree = ""; }; 4C71C6A02D06DB3D00ECCA24 /* GiftAnimationManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftAnimationManager.h; sourceTree = ""; }; 4C71C6A12D06DB3D00ECCA24 /* GiftAnimationManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftAnimationManager.m; sourceTree = ""; }; + 4C75CEF92D6318FF009147A5 /* RoomEnterModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomEnterModel.h; sourceTree = ""; }; + 4C75CEFA2D6318FF009147A5 /* RoomEnterModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomEnterModel.m; sourceTree = ""; }; + 4C75CEFC2D632CD5009147A5 /* CPEnterRoomTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CPEnterRoomTableViewCell.h; sourceTree = ""; }; + 4C75CEFD2D632CD5009147A5 /* CPEnterRoomTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = CPEnterRoomTableViewCell.m; sourceTree = ""; }; + 4C75CEFF2D633C27009147A5 /* CP进场.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CP进场.svga"; sourceTree = ""; }; 4C7989EA2D19392E006AE07B /* EmptyDataView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = EmptyDataView.h; sourceTree = ""; }; 4C7989EB2D19392E006AE07B /* EmptyDataView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = EmptyDataView.m; sourceTree = ""; }; 4C7989ED2D195277006AE07B /* RoomModeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomModeViewController.h; sourceTree = ""; }; @@ -2624,12 +2654,32 @@ 4C7989F22D1952DA006AE07B /* RoomModePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomModePresenter.m; sourceTree = ""; }; 4C815A152CFEB758002A46A6 /* SuperBlockViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SuperBlockViewController.h; sourceTree = ""; }; 4C815A162CFEB758002A46A6 /* SuperBlockViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SuperBlockViewController.m; sourceTree = ""; }; + 4C864A002D55F4F600191AE0 /* LuckyPackagePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackagePresenter.h; sourceTree = ""; }; + 4C864A012D55F4F600191AE0 /* LuckyPackagePresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackagePresenter.m; sourceTree = ""; }; + 4C864A032D561E1D00191AE0 /* LuckyPackageLogicManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackageLogicManager.h; sourceTree = ""; }; + 4C864A042D561E1D00191AE0 /* LuckyPackageLogicManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackageLogicManager.m; sourceTree = ""; }; + 4CA532B22D5AEE9400B8F59F /* Api+LuckyPackage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+LuckyPackage.h"; sourceTree = ""; }; + 4CA532B32D5AEE9400B8F59F /* Api+LuckyPackage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+LuckyPackage.m"; sourceTree = ""; }; + 4CA532B52D5B333200B8F59F /* RoomLuckyPackageInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomLuckyPackageInfoModel.h; sourceTree = ""; }; + 4CA532B62D5B333200B8F59F /* RoomLuckyPackageInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomLuckyPackageInfoModel.m; sourceTree = ""; }; + 4CA532B82D5C8EBE00B8F59F /* LuckyPackageBannerView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackageBannerView.h; sourceTree = ""; }; + 4CA532B92D5C8EBE00B8F59F /* LuckyPackageBannerView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackageBannerView.m; sourceTree = ""; }; + 4CA532BB2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OpenLuckyPackageEntranceView.h; sourceTree = ""; }; + 4CA532BC2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OpenLuckyPackageEntranceView.m; sourceTree = ""; }; + 4CA532BE2D5CA4D300B8F59F /* LuckyPackageStatusView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackageStatusView.h; sourceTree = ""; }; + 4CA532BF2D5CA4D300B8F59F /* LuckyPackageStatusView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackageStatusView.m; sourceTree = ""; }; + 4CA532C12D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackageMessageTableViewCell.h; sourceTree = ""; }; + 4CA532C22D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackageMessageTableViewCell.m; sourceTree = ""; }; 4CB753D02D30F10900B13DF5 /* LuckyPackageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LuckyPackageViewController.h; sourceTree = ""; }; 4CB753D12D30F10900B13DF5 /* LuckyPackageViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LuckyPackageViewController.m; sourceTree = ""; }; 4CC619582CEC7770008C1EE8 /* MyDressingDataPresent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataPresent.h; sourceTree = ""; }; 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 = ""; }; + 4CD6FF642D673A5C00262AB7 /* AgentMessageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AgentMessageModel.h; sourceTree = ""; }; + 4CD6FF652D673A5C00262AB7 /* AgentMessageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AgentMessageModel.m; sourceTree = ""; }; + 4CD6FF672D673F7F00262AB7 /* AgentMessageTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AgentMessageTableViewCell.h; sourceTree = ""; }; + 4CD6FF682D673F7F00262AB7 /* AgentMessageTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AgentMessageTableViewCell.m; sourceTree = ""; }; 4CE3A9442D22754C003F0796 /* RechargeUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RechargeUserModel.h; sourceTree = ""; }; 4CE3A9452D22754C003F0796 /* RechargeUserModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RechargeUserModel.m; sourceTree = ""; }; 4CEB9EA52D09643E00443480 /* UserRoomCardViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserRoomCardViewController.h; sourceTree = ""; }; @@ -3574,8 +3624,6 @@ E8383696298A598D00112E1C /* MessageTipsModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageTipsModel.m; sourceTree = ""; }; E8383698298A59C100112E1C /* MessageTipsView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageTipsView.h; sourceTree = ""; }; E8383699298A59C100112E1C /* MessageTipsView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MessageTipsView.m; sourceTree = ""; }; - E838D99E275E1BF60079E0B5 /* XPRoomAnimationView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomAnimationView.h; sourceTree = ""; }; - E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomAnimationView.m; sourceTree = ""; }; E839532B276A030F00CF2F24 /* XPMineDressUpListViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressUpListViewController.h; sourceTree = ""; }; E839532C276A030F00CF2F24 /* XPMineDressUpListViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineDressUpListViewController.m; sourceTree = ""; }; E839532F276A03AE00CF2F24 /* Api+DressUp.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+DressUp.h"; sourceTree = ""; }; @@ -5245,6 +5293,8 @@ E8B825CC26EA18C8009E8E9F /* DJDKMIMOMColor.m */, 4CEB9EA82D097E8400443480 /* MoliAvatar.h */, 4CEB9EA92D097E8400443480 /* MoliAvatar.m */, + 4C1392972D6DB4CD00A6DFB5 /* MoliMoneyLabel.h */, + 4C1392982D6DB4CD00A6DFB5 /* MoliMoneyLabel.m */, 4CEB9EAB2D09AA0400443480 /* SexAgeLabel.h */, 4CEB9EAC2D09AA0400443480 /* SexAgeLabel.m */, 4C7989EA2D19392E006AE07B /* EmptyDataView.h */, @@ -6683,8 +6733,20 @@ 4CB753CF2D30F08E00B13DF5 /* LuckyPackage */ = { isa = PBXGroup; children = ( + 4C864A002D55F4F600191AE0 /* LuckyPackagePresenter.h */, + 4C864A012D55F4F600191AE0 /* LuckyPackagePresenter.m */, 4CB753D02D30F10900B13DF5 /* LuckyPackageViewController.h */, 4CB753D12D30F10900B13DF5 /* LuckyPackageViewController.m */, + 4C864A032D561E1D00191AE0 /* LuckyPackageLogicManager.h */, + 4C864A042D561E1D00191AE0 /* LuckyPackageLogicManager.m */, + 4CA532B82D5C8EBE00B8F59F /* LuckyPackageBannerView.h */, + 4CA532B92D5C8EBE00B8F59F /* LuckyPackageBannerView.m */, + 4CA532BB2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.h */, + 4CA532BC2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.m */, + 4CA532BE2D5CA4D300B8F59F /* LuckyPackageStatusView.h */, + 4CA532BF2D5CA4D300B8F59F /* LuckyPackageStatusView.m */, + 4CA532C12D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.h */, + 4CA532C22D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.m */, ); path = LuckyPackage; sourceTree = ""; @@ -6742,6 +6804,8 @@ isa = PBXGroup; children = ( 54C608502CBE0BEB003DD5D2 /* game_floating_bg.svga */, + 4C13929B2D70441500A6DFB5 /* giftgift.mp4 */, + 4C1392A02D71675900A6DFB5 /* coincoin.mp4 */, ); path = game; sourceTree = ""; @@ -6776,6 +6840,7 @@ 54FFD3802C9BD12600DE61E5 /* cp */ = { isa = PBXGroup; children = ( + 4C75CEFF2D633C27009147A5 /* CP进场.svga */, 544B19B72CA169BE00885BEB /* level up 1.svga */, 544B19B82CA169BE00885BEB /* level up 2.svga */, 544B19B92CA169BE00885BEB /* level up 3.svga */, @@ -7579,6 +7644,10 @@ 544879EF2CD22D4B00D58DC1 /* CustomRoomBGItemModel.m */, 4C5527BA2D1BDCDE00833FFD /* RoomLevelInfoModel.h */, 4C5527BB2D1BDCDE00833FFD /* RoomLevelInfoModel.m */, + 4CA532B52D5B333200B8F59F /* RoomLuckyPackageInfoModel.h */, + 4CA532B62D5B333200B8F59F /* RoomLuckyPackageInfoModel.m */, + 4C75CEF92D6318FF009147A5 /* RoomEnterModel.h */, + 4C75CEFA2D6318FF009147A5 /* RoomEnterModel.m */, ); path = Model; sourceTree = ""; @@ -7594,6 +7663,8 @@ 546104182CD4C06400066B21 /* Api+CustomBackground.m */, 4CFFEFCE2D3A5E130035D016 /* Api+SuperAdmin.h */, 4CFFEFCF2D3A5E130035D016 /* Api+SuperAdmin.m */, + 4CA532B22D5AEE9400B8F59F /* Api+LuckyPackage.h */, + 4CA532B32D5AEE9400B8F59F /* Api+LuckyPackage.m */, ); path = Api; sourceTree = ""; @@ -7916,6 +7987,8 @@ 235714882BECC38F004C81D6 /* MessageHeadlinesTextModel.m */, 54C9A1202C3E6C3200C6D970 /* MessageGameOrderModel.h */, 54C9A1212C3E6C3200C6D970 /* MessageGameOrderModel.m */, + 4CD6FF642D673A5C00262AB7 /* AgentMessageModel.h */, + 4CD6FF652D673A5C00262AB7 /* AgentMessageModel.m */, ); path = SesssionModel; sourceTree = ""; @@ -8362,8 +8435,6 @@ 9B86D8792817DD8400494FCD /* XPRoomEnterHideTipView.m */, E8998D7E28597B0300C68558 /* XPRoomLuckyBigPrizeView.h */, E8998D7F28597B0300C68558 /* XPRoomLuckyBigPrizeView.m */, - E838D99E275E1BF60079E0B5 /* XPRoomAnimationView.h */, - E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */, 4C71C6A02D06DB3D00ECCA24 /* GiftAnimationManager.h */, 4C71C6A12D06DB3D00ECCA24 /* GiftAnimationManager.m */, 4C71C69D2D069D2B00ECCA24 /* GiftAnimationHelper.h */, @@ -9270,6 +9341,10 @@ E85E7B832A4EC99200B6D00A /* XPMineGiveDiamondDetailsVC.m */, E85E7B812A4EC99200B6D00A /* XPMineGiveDiamondVC.h */, E85E7B9A2A4EC99200B6D00A /* XPMineGiveDiamondVC.m */, + 4C1392912D6D963600A6DFB5 /* SubRechargersViewController.h */, + 4C1392922D6D963600A6DFB5 /* SubRechargersViewController.m */, + 4C1392942D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.h */, + 4C1392952D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m */, ); path = View; sourceTree = ""; @@ -9366,6 +9441,8 @@ E875A1B729755EE200AB1BBD /* SessionUserInfoTableViewCell.m */, E885D531297798E1004DC088 /* SessionSettingTableViewCell.h */, E885D532297798E1004DC088 /* SessionSettingTableViewCell.m */, + 4CD6FF672D673F7F00262AB7 /* AgentMessageTableViewCell.h */, + 4CD6FF682D673F7F00262AB7 /* AgentMessageTableViewCell.m */, ); path = Cell; sourceTree = ""; @@ -11296,6 +11373,8 @@ 9BE01ACD28925F7D00B50299 /* XPMineNewUserRechargeView.m */, 4C815A152CFEB758002A46A6 /* SuperBlockViewController.h */, 4C815A162CFEB758002A46A6 /* SuperBlockViewController.m */, + 4C75CEFC2D632CD5009147A5 /* CPEnterRoomTableViewCell.h */, + 4C75CEFD2D632CD5009147A5 /* CPEnterRoomTableViewCell.m */, ); path = SubViews; sourceTree = ""; @@ -11534,6 +11613,7 @@ E80EC88728ACD84000D133C5 /* emoji_29@2x.png in Resources */, E80EC83728ACD84000D133C5 /* emoji_112@2x.png in Resources */, E80EC88C28ACD84000D133C5 /* emoji_46@2x.png in Resources */, + 4C13929D2D70441500A6DFB5 /* giftgift.mp4 in Resources */, E80EC86028ACD84000D133C5 /* emoji_30@2x.png in Resources */, E80EC84928ACD84000D133C5 /* emoji_116@2x.png in Resources */, E80EC89328ACD84000D133C5 /* emoji_166@2x.png in Resources */, @@ -11560,6 +11640,7 @@ 548E01C52C3F78360071C83D /* FeedBackViewController.xib in Resources */, 23FF25622ABAE6310064E904 /* pi_room_game_fine_love.svga in Resources */, 23FF42672AA5CFBB0055733C /* home_sound_wave.gif in Resources */, + 4C1392A12D71675900A6DFB5 /* coincoin.mp4 in Resources */, E80EC88A28ACD84000D133C5 /* emoji_25@2x.png in Resources */, E80EC87828ACD84000D133C5 /* emoji_135@2x.png in Resources */, E80EC8AD28ACD84100D133C5 /* emoji_07@2x.png in Resources */, @@ -11727,6 +11808,7 @@ 23CEFC572AFB8FC100576D89 /* pay_off@2x.png in Resources */, E80EC86328ACD84000D133C5 /* emoji_41@2x.png in Resources */, 2396FCE42B22BE5D0014021D /* pi_area_info.json in Resources */, + 4C75CF002D633C27009147A5 /* CP进场.svga in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -11855,6 +11937,7 @@ E85E7B112A4EB0D200B6D00A /* GuildPersonIncomeRecordModel.m in Sources */, 54283CEB2CE48B71009729B5 /* ShoppingMallCategoryListView.m in Sources */, 548E01CC2C3FB1C70071C83D /* i18nGiftNameMap.m in Sources */, + 4CA532B42D5AEE9400B8F59F /* Api+LuckyPackage.m in Sources */, 9BD2ECD2288F833B00F5CD9A /* XPMineFootPrintModel.m in Sources */, E824546626F5FF6000BE8163 /* XPMineResetPayPasswordProtocol.h in Sources */, 23D321E22ADFD0FB006B259C /* PIRedPacketChooseTypeCell.m in Sources */, @@ -12163,6 +12246,7 @@ 9B42869C28C1FD3D009034D2 /* XPOpenRedPacketCell.m in Sources */, 23D321D22ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m in Sources */, 239D0FD22C046EAD002977CE /* MSTabbarRoomGameView.m in Sources */, + 4C864A052D561E1D00191AE0 /* LuckyPackageLogicManager.m in Sources */, 9BFE992E288142FD009DA429 /* RoomClassifyModel.m in Sources */, 2331C1B72A60F32D00E1D940 /* XPCandyRankContainerView.m in Sources */, 239D0FF72C05BD2A002977CE /* MSRoomGameVictoryView.m in Sources */, @@ -12324,6 +12408,7 @@ 9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */, 23EE970A2BA2D39C00475D69 /* PIWebViewSavePhotoView.m in Sources */, 2331C1B42A60F32D00E1D940 /* XPCandyTreeRankTableViewCell.m in Sources */, + 4CA532BD2D5CA49A00B8F59F /* OpenLuckyPackageEntranceView.m in Sources */, 9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */, E85E7B0D2A4EB0D200B6D00A /* GuildSuperAdminInfoModel.m in Sources */, 54F1790A2C8EDDF400CB5219 /* CountdownRingView.m in Sources */, @@ -12413,7 +12498,9 @@ 23194DBB2AD13EAB00649F51 /* PILoginManager.m in Sources */, E8DEC99E2764A5B60078CB70 /* XPRoomMoreMenuViewController.m in Sources */, 4C6E1F7C2CEB25B10073D0A3 /* ShoppingMallItemPreview.m in Sources */, + 4CA532C02D5CA4D300B8F59F /* LuckyPackageStatusView.m in Sources */, E82325F2274E2DE6003A3332 /* XPUserCardViewController.m in Sources */, + 4CA532B72D5B333200B8F59F /* RoomLuckyPackageInfoModel.m in Sources */, E85E7B512A4EB0D300B6D00A /* Api+Guild.m in Sources */, E83645682A40A2DC00E0DBE4 /* XPSkillCardPlayerManager.m in Sources */, E8F65C222869A36F009BB5B9 /* ContentShareMonentsModel.m in Sources */, @@ -12474,6 +12561,7 @@ 9B1B72BF2800422E003FACE9 /* XPAnchorPKRuleView.m in Sources */, 54F469352C29711400A83655 /* XPMomentUserDataViewController.m in Sources */, 1427219729A75F6F00C7C423 /* DDRange.m in Sources */, + 4CD6FF662D673A5C00262AB7 /* AgentMessageModel.m in Sources */, E85E7B6E2A4EC4AE00B6D00A /* XPMineGuildPresenter.m in Sources */, 23CEFC5B2AFB8FC100576D89 /* BSSelectView.m in Sources */, E81125CA296E606F000D9804 /* QPhotoImageModel.m in Sources */, @@ -12498,6 +12586,7 @@ 18A61BE8274F9CF000A09A54 /* SessionListViewController.m in Sources */, E8C1CD6A27D8937800376F83 /* XPRoomFaceCollectionViewCell.m in Sources */, 9B2EA7C02804037700ED17BF /* AnchorPKStageView.m in Sources */, + 4C1392992D6DB4CD00A6DFB5 /* MoliMoneyLabel.m in Sources */, 23CEFC622AFB8FC100576D89 /* BSLogNetDetailViewController.m in Sources */, 238B37CF2AC55A2C00BFC9D5 /* XPTreasureFairySendRecordView.m in Sources */, 238B37C52AC55A2C00BFC9D5 /* XPTreasureFairyMoreView.m in Sources */, @@ -12610,6 +12699,7 @@ 237700D72BC7D51400D661F1 /* UIButton+MSRTL.m in Sources */, E85E7B4F2A4EB0D300B6D00A /* XPMineExchangeAuthorityVC.m in Sources */, 23FE47DB2BB4171C00F09D23 /* PINobleCenterListView.m in Sources */, + 4C75CEFB2D6318FF009147A5 /* RoomEnterModel.m in Sources */, E84A2E932A527EC800D6AF8A /* XPIncomeRecordPresent.m in Sources */, 236B2E432AA07D06003967A8 /* NSString+RW.m in Sources */, 239D0FC92C045F92002977CE /* MSRoomGameVC.m in Sources */, @@ -12663,6 +12753,7 @@ E81366E726F0A49E0076364C /* NSString+Utils.m in Sources */, 23194DD22AD14BF000649F51 /* DDFileLogger.m in Sources */, E8EEB90126FC31B6007C6EBA /* XPMineUserInfoPresenter.m in Sources */, + 4C864A022D55F4F600191AE0 /* LuckyPackagePresenter.m in Sources */, E81A65312834E53600F55894 /* XPMomentsLatestViewController.m in Sources */, 18F404BB2760982000A6C548 /* ChatLimitModel.m in Sources */, E8A30BE828534A63003B4873 /* XPSessionFindNewTableViewCell.m in Sources */, @@ -12687,6 +12778,7 @@ 2331C1AB2A60F32D00E1D940 /* CandyTreeResultModel.m in Sources */, 23C9DFC32B84807A00B51558 /* PIRoomActivityClickView.m in Sources */, 1427218B29A75F6F00C7C423 /* HTTPFileResponse.m in Sources */, + 4C75CEFE2D632CD5009147A5 /* CPEnterRoomTableViewCell.m in Sources */, E839533C276A0CCD00CF2F24 /* XPMineCarTableViewCell.m in Sources */, 2331C1B62A60F32D00E1D940 /* XPCandyTreeInsufficientBalanceView.m in Sources */, E8751E7128A6541B0056EF44 /* RoomSailingRankModel.m in Sources */, @@ -12750,6 +12842,7 @@ 9B6E8577281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m in Sources */, E85E7BC22A4EE82300B6D00A /* XPMineListCell.m in Sources */, E880B3A6278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m in Sources */, + 4C1392932D6D963700A6DFB5 /* SubRechargersViewController.m in Sources */, 5456F3C82C6EF962000E1805 /* VIPCenterViewController.m in Sources */, E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */, E8F1559028125E2D00EE8C06 /* MessageAudioCenter.m in Sources */, @@ -12961,6 +13054,7 @@ 54E4D5332C90658C009E1FEA /* LuckyGiftWinningBannerView.m in Sources */, E86A16BF2856D4D5004228B8 /* XPSessionFindNewGreetListView.m in Sources */, E85E7B312A4EB0D300B6D00A /* XPNewGuildIncomeHeaderView.m in Sources */, + 4CA532C32D5F37DC00B8F59F /* LuckyPackageMessageTableViewCell.m in Sources */, 9B0997A327F19DE500EB8F14 /* QGHWDShaders.metal in Sources */, E8778AF02988EF0600CF139B /* XPSessionSayHelloViewController.m in Sources */, 187EEEE126E89BFB002833B2 /* AccountModel.m in Sources */, @@ -12973,6 +13067,8 @@ 238B37B12AC55A2C00BFC9D5 /* XPTreasureFairyFriendCell.m in Sources */, E8751E7428A665BC0056EF44 /* RoomSailingInfoModel.m in Sources */, E80EC81328ACD84000D133C5 /* QKeyboardManager.m in Sources */, + 4CD6FF692D673F7F00262AB7 /* AgentMessageTableViewCell.m in Sources */, + 4C1392962D6DA22B00A6DFB5 /* RechargerTransferHistoryViewController.m in Sources */, E87DF4B32A429C6E009C1185 /* FirstChargeRoomWindowModel.m in Sources */, E8AC722126F47E23007D6E91 /* XPMineAboutUsViewController.m in Sources */, E8E21A9E28B4DFE8008F7C9D /* XPSailingBuyFuelView.m in Sources */, @@ -13069,7 +13165,6 @@ 54B9C6E72C9C2CA1003F1CC5 /* XPMineGuildTableViewCell.m in Sources */, E84B0E462727EF9D008818C6 /* XPRoomMessageParser.m in Sources */, 23E9E9A12A80C7E000B792F2 /* XPMineGuildPersonalBillRecordModel.m in Sources */, - E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */, 9B0086C627BA392B0032BD2B /* AnchorStageView.m in Sources */, 9BCD02C72796C02800F396AA /* MicroNobleWaveView.m in Sources */, 2305F3382AD9194B00AD403C /* PIRoomMessageUnlockPhotoAlbumView.m in Sources */, @@ -13093,6 +13188,7 @@ 23194DCF2AD14BF000649F51 /* DispatchQueueLogFormatter.m in Sources */, E8A30BE328534A28003B4873 /* XPSessionFindNewViewController.m in Sources */, 140A7F52299CC69000841594 /* XPTabBar.m in Sources */, + 4CA532BA2D5C8EBE00B8F59F /* LuckyPackageBannerView.m in Sources */, E85E7B0C2A4EB0D200B6D00A /* XPGuildMangerListPresenter.m in Sources */, 14DCAD0B299B5D3A00A7DD31 /* XPLoginInputView.m in Sources */, E839806B290288660084BFC8 /* XPMessageInfoModel.m in Sources */, @@ -13350,7 +13446,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.50; + MARKETING_VERSION = 20.20.51; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", @@ -13684,7 +13780,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 20.20.50; + MARKETING_VERSION = 20.20.51; OTHER_LDFLAGS = ( "$(inherited)", "-ObjC", diff --git a/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/2 (2).png b/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/2 (2).png new file mode 100644 index 00000000..8de3d156 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/2 (2).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/Contents.json new file mode 100644 index 00000000..8e94834a --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/cp_enter_message.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "2 (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/Contents.json new file mode 100644 index 00000000..005661da --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组 41.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/组 41.png b/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/组 41.png new file mode 100644 index 00000000..2ef15d1d Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/cp_enter_message_ar.imageset/组 41.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/1.png b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/1.png new file mode 100644 index 00000000..85aea9ac Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/1.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/Contents.json new file mode 100644 index 00000000..5501fd72 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "1.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/Contents.json new file mode 100644 index 00000000..4606175b --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "组 42.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/组 42.png b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/组 42.png new file mode 100644 index 00000000..3293f848 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/cp_onmic_message_ar.imageset/组 42.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_arrow.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_arrow.imageset/Contents.json new file mode 100644 index 00000000..88a97854 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_arrow.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/20.20.50/luck_package_arrow.imageset/形状 5@3x (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_arrow.imageset/形状 5@3x (1).png new file mode 100644 index 00000000..765ebe96 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_arrow.imageset/形状 5@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/5864-CP-奢华黑金 舞会.png b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/5864-CP-奢华黑金 舞会.png new file mode 100644 index 00000000..c30a1eeb Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/5864-CP-奢华黑金 舞会.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/Contents.json new file mode 100644 index 00000000..f772e319 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv1.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5864-CP-奢华黑金 舞会.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/5864-CP-奢华黑金 舞会 (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/5864-CP-奢华黑金 舞会 (1).png new file mode 100644 index 00000000..52eea0cb Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/5864-CP-奢华黑金 舞会 (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/Contents.json new file mode 100644 index 00000000..d119ab11 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv2.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5864-CP-奢华黑金 舞会 (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/5864-CP-奢华黑金 舞会 (2).png b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/5864-CP-奢华黑金 舞会 (2).png new file mode 100644 index 00000000..8f1da00b Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/5864-CP-奢华黑金 舞会 (2).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/Contents.json new file mode 100644 index 00000000..04317647 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv3.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5864-CP-奢华黑金 舞会 (2).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/5864-CP-奢华黑金 舞会 (3).png b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/5864-CP-奢华黑金 舞会 (3).png new file mode 100644 index 00000000..6dbc2233 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/5864-CP-奢华黑金 舞会 (3).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/Contents.json new file mode 100644 index 00000000..71cde328 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_bag_lv4.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "5864-CP-奢华黑金 舞会 (3).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/3@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/3@3x.png new file mode 100644 index 00000000..76e1c717 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/3@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/Contents.json new file mode 100644 index 00000000..fa52775a --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_coin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "3@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/3@3x (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/3@3x (1).png new file mode 100644 index 00000000..e0e4c5ef Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/3@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/Contents.json new file mode 100644 index 00000000..3aacb355 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_gift.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "3@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/Contents.json new file mode 100644 index 00000000..ed869bd1 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "go@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/go@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/go@3x.png new file mode 100644 index 00000000..17ce295c Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_banner_go.imageset/go@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/组 120.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bg_long.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/组 120.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_bg_long.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/组 120.imageset/组 120@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_bg_long.imageset/组 120@3x.png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/组 120.imageset/组 120@3x.png rename to YuMi/Assets.xcassets/20.20.50/luck_package_bg_long.imageset/组 120@3x.png diff --git a/YuMi/Assets.xcassets/20.20.50/组 121.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_bg_short.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/组 121.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_bg_short.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/组 121.imageset/组 120@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_bg_short.imageset/组 120@3x.png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/组 121.imageset/组 120@3x.png rename to YuMi/Assets.xcassets/20.20.50/luck_package_bg_short.imageset/组 120@3x.png diff --git a/YuMi/Assets.xcassets/20.20.50/画板 3.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_entrance_coin.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/画板 3.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_entrance_coin.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/画板 3.imageset/画板 3@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_entrance_coin.imageset/画板 3@3x.png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/画板 3.imageset/画板 3@3x.png rename to YuMi/Assets.xcassets/20.20.50/luck_package_entrance_coin.imageset/画板 3@3x.png diff --git a/YuMi/Assets.xcassets/20.20.50/画板 3 (1).imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_entrance_gift.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/画板 3 (1).imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_entrance_gift.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/画板 3 (1).imageset/画板 3@3x (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_entrance_gift.imageset/画板 3@3x (1).png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/画板 3 (1).imageset/画板 3@3x (1).png rename to YuMi/Assets.xcassets/20.20.50/luck_package_entrance_gift.imageset/画板 3@3x (1).png diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/2@3x (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/2@3x (1).png new file mode 100644 index 00000000..c388684a Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/2@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/Contents.json new file mode 100644 index 00000000..3df53e45 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "2@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.imageset/2@3x (2).png b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.imageset/2@3x (2).png new file mode 100644 index 00000000..002a25b9 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.imageset/2@3x (2).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.imageset/Contents.json new file mode 100644 index 00000000..ba886bdc --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_message_coin_ar.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/20.20.50/luck_package_message_gift.imageset/4@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift.imageset/4@3x.png new file mode 100644 index 00000000..1c900805 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift.imageset/4@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift.imageset/Contents.json new file mode 100644 index 00000000..ed396281 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift.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/20.20.50/luck_package_message_gift_ar.imageset/5@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift_ar.imageset/5@3x.png new file mode 100644 index 00000000..3682f8a6 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift_ar.imageset/5@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift_ar.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift_ar.imageset/Contents.json new file mode 100644 index 00000000..21354d0c --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_message_gift_ar.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/20.20.50/luck_package_popup_coin.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_coin.imageset/Contents.json new file mode 100644 index 00000000..c8bd6f4c --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_coin.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "缺省@3x (1).png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_popup_coin.imageset/缺省@3x (1).png b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_coin.imageset/缺省@3x (1).png new file mode 100644 index 00000000..b7b8c3a1 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_coin.imageset/缺省@3x (1).png differ diff --git a/YuMi/Assets.xcassets/20.20.50/缺省 1.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_gift.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/缺省 1.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_popup_gift.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_popup_gift.imageset/缺省@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_gift.imageset/缺省@3x.png new file mode 100644 index 00000000..238e3a3e Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_popup_gift.imageset/缺省@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/返回.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_records_back.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/返回.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_records_back.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/返回.imageset/返回@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_records_back.imageset/返回@3x.png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/返回.imageset/返回@3x.png rename to YuMi/Assets.xcassets/20.20.50/luck_package_records_back.imageset/返回@3x.png diff --git a/YuMi/Assets.xcassets/20.20.50/框.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_records_bg.imageset/Contents.json similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/框.imageset/Contents.json rename to YuMi/Assets.xcassets/20.20.50/luck_package_records_bg.imageset/Contents.json diff --git a/YuMi/Assets.xcassets/20.20.50/框.imageset/框@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_records_bg.imageset/框@3x.png similarity index 100% rename from YuMi/Assets.xcassets/20.20.50/框.imageset/框@3x.png rename to YuMi/Assets.xcassets/20.20.50/luck_package_records_bg.imageset/框@3x.png diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/Contents.json index f073b34e..c293d316 100644 --- a/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/Contents.json +++ b/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/Contents.json @@ -9,7 +9,7 @@ "scale" : "2x" }, { - "filename" : "zz 拷贝@3x.png", + "filename" : "zz 拷贝 2@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝 2@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝 2@3x.png new file mode 100644 index 00000000..a00d0c9a Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝 2@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝@3x.png b/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝@3x.png deleted file mode 100644 index 22ee925b..00000000 Binary files a/YuMi/Assets.xcassets/20.20.50/luck_package_right.imageset/zz 拷贝@3x.png and /dev/null differ diff --git a/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/Contents.json new file mode 100644 index 00000000..4f6a9295 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "切图 64@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/切图 64@3x.png b/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/切图 64@3x.png new file mode 100644 index 00000000..9bb82642 Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/send_image_icon.imageset/切图 64@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/Contents.json b/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/Contents.json new file mode 100644 index 00000000..9f018f88 --- /dev/null +++ b/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/Contents.json @@ -0,0 +1,21 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "切图 30@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/切图 30@3x.png b/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/切图 30@3x.png new file mode 100644 index 00000000..3de2d59b Binary files /dev/null and b/YuMi/Assets.xcassets/20.20.50/sub_recharger_arrow.imageset/切图 30@3x.png differ diff --git a/YuMi/Assets.xcassets/20.20.50/缺省 1.imageset/缺省@3x.png b/YuMi/Assets.xcassets/20.20.50/缺省 1.imageset/缺省@3x.png deleted file mode 100644 index 258a8e1d..00000000 Binary files a/YuMi/Assets.xcassets/20.20.50/缺省 1.imageset/缺省@3x.png and /dev/null differ diff --git a/YuMi/Config/ClientDataModel.h b/YuMi/Config/ClientDataModel.h index 70e9bf76..c6759856 100644 --- a/YuMi/Config/ClientDataModel.h +++ b/YuMi/Config/ClientDataModel.h @@ -74,7 +74,7 @@ typedef NS_ENUM(NSInteger, FaceLivenessStrategy) { @property (nonatomic, strong) NSArray *officialMsgUids; ///官方账号 小秘书 红包消息 @property (nonatomic,strong) NSArray *officialAccountUids; -@property(nonatomic,copy) NSDictionary *publicChatRoomIdMap; +//@property(nonatomic,copy) NSDictionary *publicChatRoomIdMap; // 公聊大厅房间 IDs,已不使用该业务逻辑 ///星座礼物顶部是否开启 @property (nonatomic,assign) BOOL twelveStarSwitch; /// 开房是否需要实名 diff --git a/YuMi/CustomUI/MoliMoneyLabel.h b/YuMi/CustomUI/MoliMoneyLabel.h new file mode 100644 index 00000000..b4b5155a --- /dev/null +++ b/YuMi/CustomUI/MoliMoneyLabel.h @@ -0,0 +1,29 @@ +// +// MoliMoneyLabel.h +// YuMi +// +// Created by P on 2025/2/25. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface MoliMoneyLabel : UIView + +/// 带金币 icon 的 label view +/// - Parameters: +/// - textColor: 文本颜色 +/// - font: 文本字体 +/// - position: icon 位置,1: 左,2:右 +/// - size: icon 大小 ++ (MoliMoneyLabel *)moneyLabelWithTextColot:(UIColor *)textColor font:(UIFont *)font moneyPostion:(NSInteger)position moneySize:(CGSize)size; + +- (void)updateContent:(NSString *)content; +- (void)updateFont:(UIFont *)font size:(CGSize)size; +- (void)displayIcon:(BOOL)displayOrNot; +- (void)updateSpacing:(NSInteger)space; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/CustomUI/MoliMoneyLabel.m b/YuMi/CustomUI/MoliMoneyLabel.m new file mode 100644 index 00000000..4a865cdf --- /dev/null +++ b/YuMi/CustomUI/MoliMoneyLabel.m @@ -0,0 +1,66 @@ +// +// MoliMoneyLabel.m +// YuMi +// +// Created by P on 2025/2/25. +// + +#import "MoliMoneyLabel.h" + +@interface MoliMoneyLabel() + +@property(nonatomic, strong) UILabel *label; +@property(nonatomic, strong) UIImageView *money; +@property(nonatomic, strong) UIStackView *stackView; + +@end + +@implementation MoliMoneyLabel + ++ (MoliMoneyLabel *)moneyLabelWithTextColot:(UIColor *)textColor + font:(UIFont *)font + moneyPostion:(NSInteger)position + moneySize:(CGSize)size { + MoliMoneyLabel *containerView = [[MoliMoneyLabel alloc] init]; + containerView.label = [UILabel labelInitWithText:@"" font:font textColor:textColor]; + containerView.label.minimumScaleFactor = 0.7; + containerView.label.adjustsFontSizeToFitWidth = YES; + + containerView.money = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + containerView.money.contentMode = UIViewContentModeScaleAspectFill; + NSArray *subviews = position == 1 ? @[containerView.money, containerView.label] : @[containerView.label, containerView.money]; + containerView.stackView = [[UIStackView alloc] initWithArrangedSubviews:subviews]; + containerView.stackView.spacing = 3; + [containerView addSubview:containerView.stackView]; + [containerView.stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(containerView); + }]; + + [containerView.money mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(size); + }]; + + return containerView; +} + +- (void)updateSpacing:(NSInteger)space { + self.stackView.spacing = space; +} + +- (void)displayIcon:(BOOL)displayOrNot { + self.money.hidden = !displayOrNot; +} + +- (void)updateContent:(NSString *)content { + self.label.text = content; +} + +- (void)updateFont:(UIFont *)font size:(CGSize)size { + self.label.font = font; + [self.money mas_updateConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(size); + }]; + [self layoutIfNeeded]; +} + +@end diff --git a/YuMi/CustomUI/UIViewCorner/UIView+Corner.h b/YuMi/CustomUI/UIViewCorner/UIView+Corner.h index 1cbf4a7f..23781a5b 100644 --- a/YuMi/CustomUI/UIViewCorner/UIView+Corner.h +++ b/YuMi/CustomUI/UIViewCorner/UIView+Corner.h @@ -58,6 +58,10 @@ NS_ASSUME_NONNULL_BEGIN corners:(CACornerMask)corners borderWidth:(CGFloat)borderWidth borderColor:(UIColor *)borderColor; + +- (void)setAllCornerRadius:(CGFloat)radius + borderWidth:(CGFloat)borderWidth + borderColor:(UIColor *)borderColor; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/CustomUI/UIViewCorner/UIView+Corner.m b/YuMi/CustomUI/UIViewCorner/UIView+Corner.m index de019781..b274a0f2 100644 --- a/YuMi/CustomUI/UIViewCorner/UIView+Corner.m +++ b/YuMi/CustomUI/UIViewCorner/UIView+Corner.m @@ -107,5 +107,19 @@ self.layer.borderWidth = borderWidth; self.layer.borderColor = borderColor.CGColor; } + +- (void)setAllCornerRadius:(CGFloat)radius + borderWidth:(CGFloat)borderWidth + borderColor:(UIColor *)borderColor { + // 设置指定角的圆角 + self.layer.cornerRadius = radius; + self.layer.maskedCorners = UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight; + self.layer.masksToBounds = YES; // 确保内容不会超出边界 + + // 设置边框 + self.layer.borderWidth = borderWidth; + self.layer.borderColor = borderColor.CGColor; +} + @end diff --git a/YuMi/Global/YUMIHtmlUrl.h b/YuMi/Global/YUMIHtmlUrl.h index dfb82680..f8aae1a0 100644 --- a/YuMi/Global/YUMIHtmlUrl.h +++ b/YuMi/Global/YUMIHtmlUrl.h @@ -107,6 +107,8 @@ typedef NS_ENUM(NSUInteger, URLType) { KBoomRule, /// 房间等级说明 KRoomLevelRule, + /// 红包规则说明 + KLuckyPackageRule, }; NSString * const URLWithType(URLType type); diff --git a/YuMi/Global/YUMIHtmlUrl.m b/YuMi/Global/YUMIHtmlUrl.m index 1eaae0ef..b0614968 100644 --- a/YuMi/Global/YUMIHtmlUrl.m +++ b/YuMi/Global/YUMIHtmlUrl.m @@ -25,7 +25,8 @@ NSString * const URLWithType(URLType type) { @(kLUDOUrl) : @"modules/gameRank/index.html",///LUDO排行榜路径 @(kCPRule) : @"modules/rule/cpRule.html", @(KBoomRule) : @"modules/rule/boom.html?partitionId=",///收益记录, - @(KRoomLevelRule) : @"modules/roomLevel/index.html",///收益记录, + @(KRoomLevelRule) : @"modules/roomLevel/index.html",///房间等级, + @(KLuckyPackageRule) : @"modules/luckyBagRules/index.html",///红包礼物, }; NSString * newUrl = [newDic objectForKey:@(type)]; if(newUrl != nil){ diff --git a/YuMi/Info.plist b/YuMi/Info.plist index 3e813753..26726a26 100644 --- a/YuMi/Info.plist +++ b/YuMi/Info.plist @@ -143,5 +143,7 @@ UIViewControllerBasedStatusBarAppearance + FacebookAutoLogAppEventsEnabled + diff --git a/YuMi/Modules/ShoppingMall/MyDressingViewController.m b/YuMi/Modules/ShoppingMall/MyDressingViewController.m index ced88434..69db2703 100644 --- a/YuMi/Modules/ShoppingMall/MyDressingViewController.m +++ b/YuMi/Modules/ShoppingMall/MyDressingViewController.m @@ -310,7 +310,7 @@ static NSArray *> *MyDressUpOptions(void) { [TTPopup dismiss]; dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self showSuccessToast:YMLocalizedString(@"XPDressUpShopListViewController0")]; - [self.listView refreshCurrentPageData]; + [self.listView updateSelectedItem:indexPath]; }); } failure:^(NSError * _Nonnull error) { @kStrongify(self); diff --git a/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.h b/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.h index 4ecc65a8..053626c9 100644 --- a/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.h +++ b/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.h @@ -33,7 +33,6 @@ typedef void (^FetchDataForMyDressingPage)(NSInteger pageIndex, NSInteger pageNu @property(nonatomic, copy) void(^returnMyDressingSelectedModel)(MyDressingDataModel * _Nullable model, NSInteger type, NSIndexPath *indexPath); - (void)updateSelectedItem:(NSIndexPath *)indexPath; -- (void)refreshCurrentPageData; @end diff --git a/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.m b/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.m index 55d58b15..4fe6434d 100644 --- a/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.m +++ b/YuMi/Modules/ShoppingMall/ShoppingMallCategoryListView.m @@ -790,6 +790,7 @@ @property (nonatomic, strong) UIScrollView *mallItemsScrollView; @property (nonatomic, strong) NSMutableArray *categoryCardArray; @property (nonatomic, strong) NSMutableArray *itemCollectionViewArray; +@property (nonatomic, strong) NSMutableArray *itemCollectionLoadingViewArray; @property (nonatomic, strong) NSMutableDictionary*> *dataCache; // 缓存每页数据 - 商城页 @property (nonatomic, strong) NSMutableDictionary*> *myDressingDataCache; // 缓存每页数据 - 我的装扮页 @property (nonatomic, strong) NSMutableSet *requestedPages; // 记录已经请求的数据页, 通过下标判断 @@ -845,6 +846,7 @@ self.categoryCardArray = [NSMutableArray array]; self.itemCollectionViewArray = [NSMutableArray array]; + self.itemCollectionLoadingViewArray = [NSMutableArray array]; } - (void)setItems:(NSArray *)items { @@ -896,8 +898,15 @@ [collectionView registerClass:[MyDressingItemCard class] forCellWithReuseIdentifier:@"MyDressingItemCard"]; [collectionView registerClass:[MyDressingItemCard class] forCellWithReuseIdentifier:@"MyDressingItemCard_NotUsed"]; + UIActivityIndicatorView *loading = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + loading.frame = CGRectMake(screenWidth/2 - 30, 180, 60, 60); + loading.hidesWhenStopped = YES; + [collectionView addSubview:loading]; + [loading startAnimating]; + [self.mallItemsScrollView addSubview:collectionView]; [self.itemCollectionViewArray addObject:collectionView]; + [self.itemCollectionLoadingViewArray addObject:loading]; if (self.isForMyDressingPage) { [self addRefreshControl:collectionView]; @@ -968,7 +977,7 @@ // 我的装扮页逻辑,若有使用中的装扮,选中。否则选中“未使用” for (UICollectionView *itemView in self.itemCollectionViewArray) { - [itemView reloadData]; + NSArray *items = [self.myDressingDataCache objectForKey:@(index)]; if (items.count > 0) { NSInteger selectedIndex = 0; @@ -993,11 +1002,19 @@ NSArray *data = self.dataCache[@(itemView.tag)]; self.returnSelectedModel(data.firstObject); } + + [itemView reloadData]; } } - (void)updateItemCollectionViewWithShoppingMallData:(NSArray *)data atIndex:(NSInteger)index { + + UIActivityIndicatorView *loading = [self.itemCollectionLoadingViewArray xpSafeObjectAtIndex:index]; + if (loading) { + [loading stopAnimating]; + } + if (!data) { return; } @@ -1012,12 +1029,18 @@ if (self.returnSelectedModel) { self.returnSelectedModel(data.firstObject); } + [itemView reloadData]; } } - (void)updateItemCollectionViewWithMyDressingData:(NSArray *)data pageNum:(NSInteger)pageNum atIndex:(NSInteger)index { + UIActivityIndicatorView *loading = [self.itemCollectionLoadingViewArray xpSafeObjectAtIndex:index]; + if (loading) { + [loading stopAnimating]; + } + NSMutableArray *sortedData = data.mutableCopy; [sortedData sortUsingComparator:^NSComparisonResult(MyDressingDataModel * _Nonnull obj1, MyDressingDataModel * _Nonnull obj2) { if (obj1.used) { @@ -1054,7 +1077,6 @@ [itemView.refreshControl endRefreshing]; [itemView.mj_header endRefreshing]; [itemView.mj_footer endRefreshing]; - [itemView reloadData]; if (data.count == 0 || data.count < 20) { [itemView.mj_footer endRefreshingWithNoMoreData]; @@ -1066,6 +1088,8 @@ withObject:currentPageNum]; } } + + [itemView reloadData]; } } diff --git a/YuMi/Modules/ShoppingMall/ShoppingMallDataPresent.m b/YuMi/Modules/ShoppingMall/ShoppingMallDataPresent.m index 3f70ecf4..2da17b5c 100644 --- a/YuMi/Modules/ShoppingMall/ShoppingMallDataPresent.m +++ b/YuMi/Modules/ShoppingMall/ShoppingMallDataPresent.m @@ -23,7 +23,7 @@ if (failure) { failure([NSError errorWithDomain:[NSString isEmpty:msg] ? @"" : msg code:code userInfo:nil]); } - } showLoading:YES errorToast:YES] + } showLoading:NO errorToast:YES] dressType:@(type).stringValue]; } diff --git a/YuMi/Modules/ShoppingMall/ShoppingMallViewController.m b/YuMi/Modules/ShoppingMall/ShoppingMallViewController.m index e94a8c75..1f3ba724 100644 --- a/YuMi/Modules/ShoppingMall/ShoppingMallViewController.m +++ b/YuMi/Modules/ShoppingMall/ShoppingMallViewController.m @@ -161,13 +161,13 @@ static NSArray *> *DressUpOptions(void) { #pragma mark - - (void)fetchDataForPage:(NSInteger)pageIndex completion:(FetchDataCompletion)completion { - [self.presenter loadCategoryItems:pageIndex success:^(NSArray * array) { - if (completion) { - completion(array); - } - } failure:^(NSError * _Nonnull error) { -// TODO: 增加错误处理 - }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.25 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [self.presenter loadCategoryItems:pageIndex success:^(NSArray * array) { + if (completion) { + completion(array); + } + } failure:^(NSError * _Nonnull error) {}]; + }); } - (void)updateBottomControlArea { diff --git a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m index 067218a4..f2abe725 100644 --- a/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m +++ b/YuMi/Modules/YMLogin/View/NewLogin/XPLoginViewController.m @@ -69,9 +69,9 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; @property(nonatomic,strong) UILabel *nextLabel; ///选择手机登录 -@property(nonatomic,strong) UIButton *chooseAccountBtn; +@property(nonatomic,strong) UIButton *currentLoginWayButton; ///选择密码登录 -@property(nonatomic,strong) UIButton *chooseSMSBtn; +@property(nonatomic,strong) UIButton *otherLoginWayButton; /// 手机号输入框 @property (nonatomic, strong) XPLoginInputView *phoneInputView; /// 验证码输入框 @@ -162,8 +162,8 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; [self.view addSubview:self.logoView]; [self.view addSubview:self.feedBackButton]; - [self.view addSubview:self.chooseAccountBtn]; - [self.view addSubview:self.chooseSMSBtn]; + [self.view addSubview:self.currentLoginWayButton]; + [self.view addSubview:self.otherLoginWayButton]; [self.view addSubview:self.accountView]; [self.view addSubview:self.accountPwdView]; @@ -205,18 +205,17 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; }]; CGFloat width = KScreenWidth/2; - [self.chooseAccountBtn mas_makeConstraints:^(MASConstraintMaker *make) { + [self.currentLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); make.height.mas_equalTo(kGetScaleWidth(22)); make.width.mas_equalTo(width); - make.top.equalTo(self.logoView.mas_bottom).mas_offset(kGetScaleWidth(31)); + make.top.equalTo(self.logoView.mas_bottom).mas_offset(kGetScaleWidth(15)); }]; - [self.accountView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.equalTo(self.view); make.width.mas_equalTo(kGetScaleWidth(303)); - make.top.mas_equalTo(self.chooseAccountBtn.mas_bottom).offset(kGetScaleWidth(13)); + make.top.mas_equalTo(self.currentLoginWayButton.mas_bottom).offset(kGetScaleWidth(13)); make.height.mas_equalTo(kGetScaleWidth(52)); }]; @@ -252,10 +251,10 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; make.centerX.mas_equalTo(self.view); }]; - [self.chooseSMSBtn mas_makeConstraints:^(MASConstraintMaker *make) { + [self.otherLoginWayButton mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(kGetScaleWidth(22)); make.width.mas_equalTo(width); - make.top.equalTo(self.stackView.mas_bottom).mas_offset(kGetScaleWidth(31)); + make.top.equalTo(self.stackView.mas_bottom).mas_offset(kGetScaleWidth(23)); make.centerX.mas_equalTo(self.stackView); }]; @@ -409,7 +408,6 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; self.authBubbleView.alpha = 1.0; }]; } - } /// 点击同意 @@ -495,18 +493,16 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; } -(void)chooseAccountAction{ - self.loginType = 0; + // self.loginType = self.loginType == 0 ? 1 : 0; } -(void)chooseSMSAction{ - self.loginType = 1; + self.loginType = self.loginType == 0 ? 1 : 0; } -(void)setLoginType:(int)selectType{ _loginType = selectType; - - _chooseAccountBtn.selected = _loginType == 0; - _chooseSMSBtn.selected = _loginType != 0; + _forgetBtn.hidden = _loginType != 0; _accountView.hidden = _loginType != 0; @@ -514,6 +510,21 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; _phoneInputView.hidden = _loginType == 0; _codeInputView.hidden = _loginType == 0; + + switch (selectType) { + case 0: + [_currentLoginWayButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController9") forState:UIControlStateNormal]; + [_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27")forState:UIControlStateNormal]; + break; + case 1: + [_currentLoginWayButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController10") forState:UIControlStateNormal]; + [_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_26")forState:UIControlStateNormal]; + break; + + default: + break; + } + } #pragma mark - XPLoginInputViewDelegate @@ -812,31 +823,32 @@ NSString * const HadAgreePrivacy = @"HadAgreePrivacy"; return _loginBtn; } -- (UIButton *)chooseAccountBtn{ - if(!_chooseAccountBtn){ - _chooseAccountBtn = [UIButton new]; - [_chooseAccountBtn setTitle:YMLocalizedString(@"XPLoginPhoneViewController9" ) forState:UIControlStateNormal]; - [_chooseAccountBtn setTitleColor:UIColorFromRGB(0x84868A) forState:UIControlStateNormal]; - [_chooseAccountBtn setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected]; - _chooseAccountBtn.titleLabel.font = kFontMedium(16); - [_chooseAccountBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; - _chooseAccountBtn.selected = YES; - [_chooseAccountBtn addTarget:self action:@selector(chooseAccountAction) forControlEvents:UIControlEventTouchUpInside]; +- (UIButton *)currentLoginWayButton{ + if(!_currentLoginWayButton){ + _currentLoginWayButton = [UIButton new]; + [_currentLoginWayButton setTitle:YMLocalizedString(@"XPLoginPhoneViewController9" ) forState:UIControlStateNormal]; + [_currentLoginWayButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal]; + [_currentLoginWayButton setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected]; + _currentLoginWayButton.titleLabel.font = kFontMedium(16); + [_currentLoginWayButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; + _currentLoginWayButton.selected = NO; + [_currentLoginWayButton addTarget:self action:@selector(chooseAccountAction) forControlEvents:UIControlEventTouchUpInside]; } - return _chooseAccountBtn; + return _currentLoginWayButton; } -- (UIButton *)chooseSMSBtn{ - if(!_chooseSMSBtn){ - _chooseSMSBtn = [UIButton new]; - [_chooseSMSBtn setTitle:YMLocalizedString(@"XPLoginPhoneViewController10") forState:UIControlStateNormal]; - [_chooseSMSBtn setTitleColor:UIColorFromRGB(0x84868A) forState:UIControlStateNormal]; - [_chooseSMSBtn setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected]; - _chooseSMSBtn.titleLabel.font = kFontMedium(16); - [_chooseSMSBtn setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; - [_chooseSMSBtn addTarget:self action:@selector(chooseSMSAction) forControlEvents:UIControlEventTouchUpInside]; +- (UIButton *)otherLoginWayButton{ + if(!_otherLoginWayButton){ + _otherLoginWayButton = [UIButton new]; + [_otherLoginWayButton setTitle:YMLocalizedString(@"1.0.37_text_27") forState:UIControlStateNormal]; + [_otherLoginWayButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateNormal]; + [_otherLoginWayButton setTitleColor:UIColorFromRGB(0x000000) forState:UIControlStateSelected]; + _otherLoginWayButton.titleLabel.font = kFontMedium(14); + _otherLoginWayButton.selected = YES; + [_otherLoginWayButton setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10]; + [_otherLoginWayButton addTarget:self action:@selector(chooseSMSAction) forControlEvents:UIControlEventTouchUpInside]; } - return _chooseSMSBtn; + return _otherLoginWayButton; } - (XPLoginInputView *)accountView { diff --git a/YuMi/Modules/YMMessage/Api/Api+Message.h b/YuMi/Modules/YMMessage/Api/Api+Message.h index 83455bc4..81a3c066 100644 --- a/YuMi/Modules/YMMessage/Api/Api+Message.h +++ b/YuMi/Modules/YMMessage/Api/Api+Message.h @@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN + (void)checkLimit:(HttpRequestHelperCompletion)completion receiverUid:(NSString *)receiverUid; ++ (void)sendRoomImageMessage:(HttpRequestHelperCompletion)completion picUrl:(NSString *)picUrl roomUid:(NSInteger)roomUid; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/Api/Api+Message.m b/YuMi/Modules/YMMessage/Api/Api+Message.m index a52c9737..eebb6e96 100644 --- a/YuMi/Modules/YMMessage/Api/Api+Message.m +++ b/YuMi/Modules/YMMessage/Api/Api+Message.m @@ -18,5 +18,9 @@ [self makeRequest:@"privateChat/limitV2" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, receiverUid,nil]; } ++ (void)sendRoomImageMessage:(HttpRequestHelperCompletion)completion picUrl:(NSString *)picUrl roomUid:(NSInteger)roomUid { + [self makeRequest:@"roomScreen/sendPic" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, picUrl, @(roomUid), nil]; +} + @end diff --git a/YuMi/Modules/YMMessage/Model/AttachmentModel.h b/YuMi/Modules/YMMessage/Model/AttachmentModel.h index 201e688d..77b9158a 100644 --- a/YuMi/Modules/YMMessage/Model/AttachmentModel.h +++ b/YuMi/Modules/YMMessage/Model/AttachmentModel.h @@ -142,9 +142,28 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) { ///房间等级更新 CustomMessageType_RoomLevel_Update = 114, + + /// 进房类型 + CustomMessageType_User_Enter_Room = 115, + + /// 新系統消息 + CustomMessageType_System_message = 116, }; +/// first = CustomMessageType_System_message +typedef NS_ENUM(NSUInteger, CustomMessageTypeSystemmessage) { + Custom_Message_Sub_System_message = 1160, +}; + +///first = CustomMessageType_User_Enter_Room +typedef NS_ENUM(NSUInteger, CustomMessageTypeUserEnterRoom) { + /// 图片消息 + Custom_Message_Sub_Pic_Message = 1151, + /// 用户进房 + Custom_Message_Sub_User_Enter_Room = 1152, +}; + ///first = CustomMessageType_Room_Tip typedef NS_ENUM(NSUInteger, CustomMessageSubRoomTip) { ///分享房间 @@ -381,6 +400,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubRedPacket) { Custom_Message_Sub_AllDiamandRedPacket = 604, //全服钻石红包 Custom_Message_Sub_OpenRedPacketSuccess = 605,//抢红包成功 Custom_Message_Sub_NewRoomDiamandRedPacket = 606, //新版本房间钻石红包 + + Custom_Message_Sub_LuckyPackage = 607, // 最新版本房间红包推送 }; ///first = CustomMessageType_Collection_Room @@ -755,6 +776,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeRoomLevelUpdate) { @property (nonatomic,assign) int second; @property(nonatomic,assign) BOOL isBroadcast; +@property(nonatomic, assign) NSInteger seq; // 本地序号,用于将一条消息分解为多条有次序的消息 + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/Model/AttachmentModel.m b/YuMi/Modules/YMMessage/Model/AttachmentModel.m index 6f434db3..558517c6 100644 --- a/YuMi/Modules/YMMessage/Model/AttachmentModel.m +++ b/YuMi/Modules/YMMessage/Model/AttachmentModel.m @@ -18,64 +18,64 @@ return [self toJSONString]; } -- (NSDictionary *)toDictionary { - NSMutableDictionary *dict = [NSMutableDictionary dictionary]; - - if (self.data) { - dict[@"data"] = self.data; - } - dict[@"first"] = @(self.first); - dict[@"second"] = @(self.second); - dict[@"isBroadcast"] = @(self.isBroadcast); - - return [dict copy]; -} - -- (NSString *)convertModelToJSONString:(AttachmentModel *)model { - if (!model) { - return nil; - } - - // 获取模型的字典表示 - NSDictionary *modelDict = [model toDictionary]; - - // 将字典序列化为 JSON 数据 - NSError *error; - NSData *jsonData = [NSJSONSerialization dataWithJSONObject:modelDict options:0 error:&error]; - - if (error) { - NSLog(@"JSON 序列化失败: %@", error.localizedDescription); - return nil; - } - - // 转换为字符串 - return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; -} - -- (NSString *)compressJSONString:(NSString *)jsonString { - if (!jsonString) return nil; - - // 将 JSON 字符串转为对象(字典或数组) - NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; - NSError *error; - id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; - - if (error) { - NSLog(@"JSON 解析错误: %@", error.localizedDescription); - return nil; - } - - // 将对象重新序列化为紧凑格式的 JSON 数据 - NSData *compressedData = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:&error]; - - if (error) { - NSLog(@"JSON 序列化错误: %@", error.localizedDescription); - return nil; - } - - // 转换为字符串 - NSString *compressedString = [[NSString alloc] initWithData:compressedData encoding:NSUTF8StringEncoding]; - return compressedString; -} +//- (NSDictionary *)toDictionary { +// NSMutableDictionary *dict = [NSMutableDictionary dictionary]; +// +// if (self.data) { +// dict[@"data"] = self.data; +// } +// dict[@"first"] = @(self.first); +// dict[@"second"] = @(self.second); +// dict[@"isBroadcast"] = @(self.isBroadcast); +// +// return [dict copy]; +//} +// +//- (NSString *)convertModelToJSONString:(AttachmentModel *)model { +// if (!model) { +// return nil; +// } +// +// // 获取模型的字典表示 +// NSDictionary *modelDict = [model toDictionary]; +// +// // 将字典序列化为 JSON 数据 +// NSError *error; +// NSData *jsonData = [NSJSONSerialization dataWithJSONObject:modelDict options:0 error:&error]; +// +// if (error) { +// NSLog(@"JSON 序列化失败: %@", error.localizedDescription); +// return nil; +// } +// +// // 转换为字符串 +// return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; +//} +// +//- (NSString *)compressJSONString:(NSString *)jsonString { +// if (!jsonString) return nil; +// +// // 将 JSON 字符串转为对象(字典或数组) +// NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; +// NSError *error; +// id jsonObject = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&error]; +// +// if (error) { +// NSLog(@"JSON 解析错误: %@", error.localizedDescription); +// return nil; +// } +// +// // 将对象重新序列化为紧凑格式的 JSON 数据 +// NSData *compressedData = [NSJSONSerialization dataWithJSONObject:jsonObject options:0 error:&error]; +// +// if (error) { +// NSLog(@"JSON 序列化错误: %@", error.localizedDescription); +// return nil; +// } +// +// // 转换为字符串 +// NSString *compressedString = [[NSString alloc] initWithData:compressedData encoding:NSUTF8StringEncoding]; +// return compressedString; +//} @end diff --git a/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.h b/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.h new file mode 100644 index 00000000..b84b36d4 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.h @@ -0,0 +1,17 @@ +// +// AgentMessageTableViewCell.h +// YuMi +// +// Created by P on 2025/2/20. +// + +#import "MessageContentCustomView.h" +#import "UIView+NIM.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AgentMessageTableViewCell : MessageContentCustomView + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.m b/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.m new file mode 100644 index 00000000..d97ec426 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/Cell/AgentMessageTableViewCell.m @@ -0,0 +1,167 @@ +// +// AgentMessageTableViewCell.m +// YuMi +// +// Created by P on 2025/2/20. +// + +#import "AgentMessageTableViewCell.h" + +#import "AgentMessageModel.h" + +@interface AgentMessageTableViewCell () + +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *messageLabel; +@property(nonatomic, strong) UIButton *agreeButton; +@property(nonatomic, strong) UIButton *rejectButton; +@property(nonatomic, strong) UIStackView *stackView; + +@end + +@implementation AgentMessageTableViewCell + +- (void)initSubViews { + [super initSubViews]; + + self.backView.backgroundColor = [UIColor whiteColor]; + + [self.backView addSubview:self.titleLabel]; + [self.backView addSubview:self.messageLabel]; + [self.backView addSubview:self.stackView]; + [self.stackView addArrangedSubview:self.rejectButton]; + [self.stackView addArrangedSubview:self.agreeButton]; +} + +- (void)initSubViewConstraints { + [super initSubViewConstraints]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.backView); + make.top.mas_equalTo(self.backView).mas_equalTo(10); + make.height.mas_equalTo(22); + }]; + [self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(self.backView); + make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_equalTo(10); + make.bottom.mas_equalTo(self.backView).offset(-40); + }]; + + [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.backView); + make.height.mas_equalTo(30); + make.bottom.mas_equalTo(-8); + }]; + + [self.rejectButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(30); + make.width.mas_equalTo(94); + }]; + + [self.agreeButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(30); + make.width.mas_equalTo(94); + }]; +} + +- (void)render:(MessageBaseModel *)message { + AgentMessageModel *model = (AgentMessageModel *)message; + + switch (model.layoutType) { + case 1: { + self.agreeButton.hidden = NO; + self.rejectButton.hidden = NO; + } + break; + case 2: { + self.agreeButton.hidden = NO; + self.rejectButton.hidden = YES; + } + break; + case 3: { + self.agreeButton.hidden = YES; + self.rejectButton.hidden = NO; + } + break; + default: + break; + } + + self.titleLabel.text = model.title; + self.messageLabel.text = model.content; +#if DEBUG + self.messageLabel.text = @"Agency member ID:10087 has applied to quit. Please review it within 24 hours. Otherwise, it will be resolved by the system within 24 hours."; +#endif +} + +#pragma mark - +- (void)didTapAgree { + +} + +- (void)didTapReject { + +} + +#pragma mark - + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc]initWithFrame:CGRectZero]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.preferredMaxLayoutWidth = CONTENT_WIDTH_MAX - MESSAGE_PADDING * 2; + _titleLabel.textColor = UIColorFromRGB(0x313131); + _titleLabel.font = kFontSemibold(15); + } + return _titleLabel; +} + +- (UILabel *)messageLabel { + if (!_messageLabel) { + _messageLabel = [[UILabel alloc]initWithFrame:CGRectZero]; + _messageLabel.textAlignment = NSTextAlignmentCenter; + _messageLabel.preferredMaxLayoutWidth = CONTENT_WIDTH_MAX - MESSAGE_PADDING * 2; + _messageLabel.textColor = UIColorFromRGB(0x313131); + _messageLabel.font = kFontRegular(14); + _messageLabel.numberOfLines = 0; + } + return _messageLabel; +} + +- (UIButton *)agreeButton { + if (!_agreeButton) { + _agreeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_agreeButton addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xE29030), + UIColorFromRGB(0xFCC074), + ] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) cornerRadius:15]; + [_agreeButton setTitle:YMLocalizedString(@"XPAnchorPKInviteView7") forState:UIControlStateNormal]; + [_agreeButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + _agreeButton.titleLabel.font = kFontMedium(14); + [_agreeButton addTarget:self action:@selector(didTapAgree) forControlEvents:UIControlEventTouchUpInside]; + } + return _agreeButton; +} + +- (UIButton *)rejectButton { + if (!_rejectButton) { + _rejectButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _rejectButton.backgroundColor = UIColorFromRGB(0xEBEBEB); + [_rejectButton setCornerRadius:15]; + [_rejectButton setTitle:YMLocalizedString(@"XPAnchorPKInviteView6") forState:UIControlStateNormal]; + [_rejectButton setTitleColor:UIColorFromRGB(0x7b7b7d) forState:UIControlStateNormal]; + _rejectButton.titleLabel.font = kFontMedium(14); + [_rejectButton addTarget:self action:@selector(didTapReject) forControlEvents:UIControlEventTouchUpInside]; + } + return _rejectButton; +} + +- (UIStackView *)stackView { + if (!_stackView) { + _stackView = [[UIStackView alloc] init]; + _stackView.spacing = 12; + } + return _stackView; +} + +@end diff --git a/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m b/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m index 3dcc749c..0414c26f 100644 --- a/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m +++ b/YuMi/Modules/YMMessage/View/Session/Content/MessageContentTextClickable.m @@ -87,21 +87,6 @@ MessageTextClickModel * textModel = (MessageTextClickModel *)message; _messageText.attributedText = textModel.attributedText; _contentInfo = textModel.contentInfo; - -// CGFloat oneHeight = [YMLocalizedString(@"MessageContentTweetView0") boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin -// attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height + 2.5; -// -// CGFloat titleHeight = [textModel.attributedText.string boundingRectWithSize:CGSizeMake(240, CGFLOAT_MAX) options:NSStringDrawingUsesFontLeading | NSStringDrawingUsesLineFragmentOrigin -// attributes:[self messageTextAttibutes:[UIFont systemFontOfSize:16] color:[DJDKMIMOMColor mainTextColor]] context:nil].size.height; -// if (titleHeight <= oneHeight * 2) { -// [self.messageText mas_updateConstraints:^(MASConstraintMaker *make) { -// make.height.mas_equalTo(titleHeight + 5); -// }]; -// } else{ -// [self.messageText mas_updateConstraints:^(MASConstraintMaker *make) { -// make.height.mas_equalTo(oneHeight * 2); -// }]; -// } } - (NSDictionary *)messageTextAttibutes:(UIFont *)font color:(UIColor *)color { NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; diff --git a/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.h b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.h new file mode 100644 index 00000000..321912dc --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.h @@ -0,0 +1,34 @@ +// +// AgentMessageModel.h +// YuMi +// +// Created by P on 2025/2/20. +// + +#import "MessageBaseModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface AgentTextStyleMessageModel: PIBaseModel + +@property(nonatomic, copy) NSString *content; +@property(nonatomic, assign) NSInteger fontSize; +@property(nonatomic, copy) NSString *fontColor; +@property(nonatomic, assign) bool fontBold; + +@end + +@interface AgentMessageModel : MessageBaseModel + +@property(nonatomic, copy) NSString *url; +@property(nonatomic, copy) NSString *title; +@property(nonatomic, copy) NSString *content; +@property(nonatomic, assign) NSInteger titleFontSize; +@property(nonatomic, assign) NSInteger contentFontSize; +@property(nonatomic, assign) NSInteger layoutType; // (0没有确定取消按钮,1,确定取消按钮,2,只有确定 3,只有取消) +@property(nonatomic, copy) NSArray *titleStyles; +@property(nonatomic, copy) NSArray *contentStyles; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.m b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.m new file mode 100644 index 00000000..459f9838 --- /dev/null +++ b/YuMi/Modules/YMMessage/View/Session/Content/SesssionModel/AgentMessageModel.m @@ -0,0 +1,70 @@ +// +// AgentMessageModel.m +// YuMi +// +// Created by P on 2025/2/20. +// + +#import "AgentMessageModel.h" +#import "AttachmentModel.h" + +@implementation AgentTextStyleMessageModel + +@end + + +@implementation AgentMessageModel + +- (instancetype)initWithMessage:(NIMMessage *)message { + if (self = [super init]) { + self.message = message; + self.isHiddenAvatar = NO; + self.messageType = SessionMessageType_Custom; + + NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; + AttachmentModel *attachment = (AttachmentModel *)obj.attachment; + NSDictionary *data = attachment.data; + if (data) { + AgentMessageModel *model = [AgentMessageModel modelWithJSON:data]; +//#if DEBUG +// model.url = @"/guildMember/quitAudit?uid\\u003d3456\\u0026"; +//#endif + self.url = model.url; + self.title = model.title; + self.content = model.content; + self.titleFontSize = model.titleFontSize; + self.contentSize = model.contentSize; + self.layoutType = model.layoutType; + self.titleStyles = model.titleStyles; + self.contentStyles = model.contentStyles; + } + + + CGSize maxSize = CGSizeMake(260, CGFLOAT_MAX); + + // 使用 NSString 的 boundingRectWithSize 方法来计算高度 + CGRect textRect = [self.content boundingRectWithSize:maxSize + options:NSStringDrawingUsesLineFragmentOrigin + attributes:@{NSFontAttributeName: kFontRegular(14)} + context:nil]; + + CGFloat titleHeight = 30; + CGFloat contentHeight = textRect.size.height; +//#if DEBUG +// contentHeight = 150; +// self.layoutType = 2; +//#endif + CGFloat buttonHeight = self.layoutType == 0 ? 0 : 40; + self.height = titleHeight + contentHeight + buttonHeight + 20; + + // TODO: 補充富文本格式 | 補充 API call 邏輯 + + } + return self; +} + +- (NSString *)cellContent:(MessageBaseModel *)model { + return @"AgentMessageTableViewCell"; +} + +@end diff --git a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m index 3f632c54..51ad4b69 100644 --- a/YuMi/Modules/YMMessage/View/Session/SessionViewController.m +++ b/YuMi/Modules/YMMessage/View/Session/SessionViewController.m @@ -80,6 +80,7 @@ #import "MessageGameOrderModel.h" #import "VIPCenterViewController.h" #import "XPSkillCardPlayerManager.h" +#import "AgentMessageModel.h" @interface CheckLimitModel :PIBaseModel @property (nonatomic, assign) BOOL chat; @@ -170,9 +171,11 @@ } - (void)headerRefresh { + @kWeakify(self); if (self.messages.count > 0) { MessageBaseModel * model = self.messages.firstObject; [[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:model.message limit:20 completion:^(NSError * _Nullable error, NSArray * _Nullable messages) { + @kStrongify(self); [self.sessionTableView.mj_header endRefreshing]; if (error == nil && messages.count > 0) { for (int i = ((int)messages.count -1); i >= 0; i--) { @@ -193,6 +196,7 @@ }]; } else { [[[NIMSDK sharedSDK] conversationManager] messagesInSession:self.session message:nil limit:20 completion:^(NSError * _Nullable error, NSArray * _Nullable messages) { + @kStrongify(self); [self.sessionTableView.mj_header endRefreshing]; if (error == nil) { for (int i = 0; i < messages.count; i++) { @@ -251,7 +255,17 @@ MessageBaseModel * model; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_Send) { +// if (attachment.first == CustomMessageType_System_message) { +// switch (attachment.second) { +// case Custom_Message_Sub_System_message: +// model = [[AgentMessageModel alloc] initWithMessage:message]; +// break; +// +// default: +// break; +// } +// } + if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_Send) { model = [[MessageGiftModel alloc] initWithMessage:message]; } else if(attachment.first == CustomMessageType_Secretary) { model = [[MessageTextClickModel alloc] initWithMessage:message]; diff --git a/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.h b/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.h index ffba19b1..7f2cac2b 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.h +++ b/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.h @@ -31,7 +31,7 @@ NS_ASSUME_NONNULL_BEGIN ///是否已经喜欢了 @property (nonatomic,assign) BOOL isLike; -@property(nonatomic,assign) BOOL isPublicChatHall; +//@property(nonatomic,assign) BOOL isPublicChatHall; ///代理 @property (nonatomic,weak) id delegate; ///是否在房间中 diff --git a/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.m b/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.m index 01454150..f80b471c 100644 --- a/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.m +++ b/YuMi/Modules/YMMessage/View/Session/View/SessionNavView.m @@ -51,12 +51,7 @@ } return self; } -- (void)setIsPublicChatHall:(BOOL)isPublicChatHall{ - _isPublicChatHall = isPublicChatHall; - self.liveView.hidden = _isPublicChatHall; - self.reportButton.hidden = _isPublicChatHall; - self.likeButton.hidden = _isPublicChatHall; -} + #pragma mark - Private Method - (void)initSubViews { self.backgroundColor = [DJDKMIMOMColor appCellBackgroundColor]; @@ -124,7 +119,7 @@ #pragma mark - Getters And Setters - (void)setUserInfo:(UserInfoModel *)userInfo { _userInfo = userInfo; - if (self.isPublicChatHall == YES){return;} + if (_userInfo) { NSString * userId = [NSString stringWithFormat:@"%ld", userInfo.uid]; self.userId = userId; @@ -138,11 +133,9 @@ }]; } - self.subTitleLabel.hidden = ![[NIMSDK sharedSDK].userManager isUserInBlackList:userId]; - self.liveView.hidden = ([[NIMSDK sharedSDK].userManager isUserInBlackList:userId] || _userInfo.roomUid.length <= 0); - self.reportButton.hidden = [NIMMessageUtils isOfficalAccount:self.userId] || self.isInRoom; - - + self.subTitleLabel.hidden = ![[NIMSDK sharedSDK].userManager isUserInBlackList:userId]; + self.liveView.hidden = ([[NIMSDK sharedSDK].userManager isUserInBlackList:userId] || _userInfo.roomUid.length <= 0); + self.reportButton.hidden = [NIMMessageUtils isOfficalAccount:self.userId] || self.isInRoom; } } @@ -150,10 +143,8 @@ _title = title; if (_title) { NSString * nick = title; - if(self.isPublicChatHall == NO){ - if (nick.length > 10 ) { - nick = [nick substringToIndex:10]; - } + if (nick.length > 10 ) { + nick = [nick substringToIndex:10]; } self.nickLabel.text = nick; } diff --git a/YuMi/Modules/YMMessage/View/SessionList/SessionListCell.m b/YuMi/Modules/YMMessage/View/SessionList/SessionListCell.m index 73f1e918..aeb6399d 100644 --- a/YuMi/Modules/YMMessage/View/SessionList/SessionListCell.m +++ b/YuMi/Modules/YMMessage/View/SessionList/SessionListCell.m @@ -54,8 +54,10 @@ NSString * uid = recent.session.sessionId; if (uid > 0) { NSArray * uids = @[uid]; + @kWeakify(self); [[NIMSDK sharedSDK].userManager fetchUserInfos:uids completion:^(NSArray * _Nullable users, NSError * _Nullable error) { if (error == nil) { + @kStrongify(self); NIMUser * userInfo = users.firstObject; self.nameLabel.text = userInfo.userInfo.nickName; NSString *avatarUrl = userInfo.userInfo.avatarUrl; diff --git a/YuMi/Modules/YMMine/Model/RechargeUserModel.h b/YuMi/Modules/YMMine/Model/RechargeUserModel.h index 76adf688..b3e3463c 100644 --- a/YuMi/Modules/YMMine/Model/RechargeUserModel.h +++ b/YuMi/Modules/YMMine/Model/RechargeUserModel.h @@ -9,6 +9,47 @@ NS_ASSUME_NONNULL_BEGIN +@interface DiamondGiveHistoryVo : PIBaseModel +@property(nonatomic, copy) NSString *id; +@property(nonatomic, assign) NSInteger fromUid; +@property(nonatomic, assign) NSInteger targetUid; +@property(nonatomic, assign) NSInteger targetErbanNo; +@property(nonatomic, assign) NSInteger readDiamondNum; +@property(nonatomic, copy) NSString *createTimeStr; +@property(nonatomic, copy) NSString *targetNick; +@property(nonatomic, copy) NSString *targetAvatar; +@property(nonatomic, assign) NSInteger diamondNum; +@property(nonatomic, assign) NSTimeInterval createTime; +@end + +@interface DiamondHistoryModel : PIBaseModel + +@property(nonatomic, assign) NSInteger totalGiveGold; +@property(nonatomic, assign) NSInteger totalGiveGoldUsd; +@property(nonatomic, copy) NSString *cycleDateStr; +@property(nonatomic, copy) NSArray * diamondGiveHistoryVoList; + +@end + + +@interface SubRechargeUserModel : PIBaseModel + +@property(nonatomic, copy) NSString *id; +@property(nonatomic, assign) NSInteger uid; +@property(nonatomic, assign) NSInteger manageUid; +@property(nonatomic, assign) NSInteger starLevel; +@property(nonatomic, assign) BOOL hasCharge; +@property(nonatomic, copy) NSString *erbanNo; +@property(nonatomic, copy) NSString *nick; +@property(nonatomic, copy) NSString *avatar; +@property(nonatomic, assign) BOOL isOnline; +@property(nonatomic, assign) NSInteger seq; +@property(nonatomic, assign) NSInteger starLevelSeq; +@property(nonatomic, assign) CGFloat totalGiveGoldUsd; //薪资 +@property(nonatomic, assign) CGFloat totalGiveGold; //转赠金币 +@end + + @interface RechargeUserModel : PIBaseModel @property(nonatomic, copy) NSString *avatar; @@ -21,6 +62,9 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, assign) NSInteger starLevel; @property(nonatomic, assign) NSInteger type; @property(nonatomic, assign) NSInteger uid; +@property(nonatomic, assign) CGFloat totalGiveGoldUsd; //薪资 +@property(nonatomic, assign) CGFloat totalGiveGold; //转赠金币 +@property(nonatomic, assign) NSInteger subNum; + (RechargeUserModel *)testModel; diff --git a/YuMi/Modules/YMMine/Model/RechargeUserModel.m b/YuMi/Modules/YMMine/Model/RechargeUserModel.m index 3ee42a10..548174e2 100644 --- a/YuMi/Modules/YMMine/Model/RechargeUserModel.m +++ b/YuMi/Modules/YMMine/Model/RechargeUserModel.m @@ -7,6 +7,25 @@ #import "RechargeUserModel.h" +@implementation DiamondGiveHistoryVo + + + +@end + +@implementation DiamondHistoryModel + ++ (NSDictionary *)objectClassInArray{ + return @{ + @"diamondGiveHistoryVoList":DiamondGiveHistoryVo.class + }; +} +@end + +@implementation SubRechargeUserModel + +@end + @implementation RechargeUserModel + (RechargeUserModel *)testModel { diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.h b/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.h index 471ad337..c0ad7fa9 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.h +++ b/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.h @@ -46,6 +46,23 @@ NS_ASSUME_NONNULL_BEGIN +(void)rechargeUserInfo:(HttpRequestHelperCompletion)completion; +/// 子代理接口 ++(void)subrechargeListInfo:(HttpRequestHelperCompletion)completion; + + +/// 用户转增历史 +/// - Parameters: +/// - completion: completion description +/// - periodType: 1-当前周期;2-上个周期 +/// - pageSize: 页内容数量 +/// - pageNo: 页数 +/// - type: 1-金币转赠历史,2-代发薪资历史 ++(void)transferDiamondHistory:(HttpRequestHelperCompletion)completion + periodType:(NSInteger)periodType + pageSize:(NSInteger)pageSize + pageNo:(NSInteger)pageNo + type:(NSInteger)type; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.m b/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.m index db3b63f5..d4afc62a 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/Api/Api+GiveDiamond.m @@ -28,4 +28,18 @@ +(void)rechargeUserInfo:(HttpRequestHelperCompletion)completion { [self makeRequest:@"recharge/user/info" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil]; } + ++(void)subrechargeListInfo:(HttpRequestHelperCompletion)completion { + [self makeRequest:@"recharge/user/subList" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, nil]; +} + ++(void)transferDiamondHistory:(HttpRequestHelperCompletion)completion + periodType:(NSInteger)periodType + pageSize:(NSInteger)pageSize + pageNo:(NSInteger)pageNo + type:(NSInteger)type { + [self makeRequest:@"user/diamond/history" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, @(periodType), @(pageSize), @(pageNo), @(type), nil]; +} + + @end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.h b/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.h index bec75e93..3f97427a 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.h +++ b/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.h @@ -28,6 +28,19 @@ NS_ASSUME_NONNULL_BEGIN ///充值代理信息 - (void)rechargeUserInfo; + +- (void)subrechargeInfoList; + + +/// yonghu1 +/// - Parameters: +/// - periodType: 1: 当前周期,2: 上个周期 +/// - page: 页数 +/// - type: 1-金币转赠历史,2-代发薪资历史 +- (void)userTransferHistory:(NSInteger)periodType + page:(NSInteger)page + type:(NSInteger)type; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.m b/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.m index 8ded3f2a..28e283eb 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/Presenter/XPMineGiveDiamondPresenter.m @@ -30,7 +30,9 @@ -(void)getGiveDiamondRecord{ NSString * uid = [AccountInfoStorage instance].getUid; NSString * ticket = [AccountInfoStorage instance].getTicket; + @kWeakify(self); [Api getGiveDiamondList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); NSArray * array = [XPMineGiveDiamondModel modelsWithArray:data.data]; [[self getView] getGiveDiamondListSuccess:array]; }] ticket:ticket uid:uid pageNum:@"1" pageSize:@"100"]; @@ -101,6 +103,31 @@ } showLoading:YES errorToast:YES]]; } + +- (void)subrechargeInfoList { + @kWeakify(self); + [Api subrechargeListInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); + if ([[self getView] respondsToSelector:@selector(loadSubRechargerInfoSuccess:)]) { + [[self getView] loadSubRechargerInfoSuccess:[SubRechargeUserModel modelsWithArray:data.data]]; + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:YES errorToast:YES]]; +} + +- (void)userTransferHistory:(NSInteger)periodType page:(NSInteger)page type:(NSInteger)type{ + @kWeakify(self); + [Api transferDiamondHistory:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); + if ([[self getView] respondsToSelector:@selector(loadTransferHistorySuccess:)]) { + [[self getView] loadTransferHistorySuccess:[DiamondHistoryModel modelWithJSON:data.data]]; + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:YES errorToast:YES] periodType:periodType pageSize:20 pageNo:page type:type]; +} + @end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/Protocol/XPMineGiveDiamondProtocol.h b/YuMi/Modules/YMMine/View/GiveDiamond/Protocol/XPMineGiveDiamondProtocol.h index 7d7db810..4859e3e6 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/Protocol/XPMineGiveDiamondProtocol.h +++ b/YuMi/Modules/YMMine/View/GiveDiamond/Protocol/XPMineGiveDiamondProtocol.h @@ -6,7 +6,7 @@ // #import -@class WalletInfoModel,XPMineGiveDiamondSearchModel,XPMineGiveDiamondDetailsModel,GiftInfoModel, RechargeUserModel; +@class WalletInfoModel,XPMineGiveDiamondSearchModel,XPMineGiveDiamondDetailsModel,GiftInfoModel, RechargeUserModel, SubRechargeUserModel, DiamondHistoryModel; NS_ASSUME_NONNULL_BEGIN @protocol XPMineGiveDiamondProtocol @@ -40,6 +40,10 @@ NS_ASSUME_NONNULL_BEGIN - (void)loadRechargeUserSuccess:(RechargeUserModel *)userModel; +- (void)loadSubRechargerInfoSuccess:(NSArray *)infos; + +- (void)loadTransferHistorySuccess:(DiamondHistoryModel *)infos; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineChooseGiveDiamondView.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineChooseGiveDiamondView.m index c209c003..eebf3693 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineChooseGiveDiamondView.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineChooseGiveDiamondView.m @@ -378,7 +378,7 @@ NetImageConfig *config = [[NetImageConfig alloc]init]; config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; _headView = [[NetImageView alloc]initWithConfig:config]; - _headView.layer.cornerRadius = kGetScaleWidth(25); + _headView.layer.cornerRadius = kGetScaleWidth(59/2); _headView.layer.masksToBounds = YES; } return _headView; diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.h b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.h index 7706be5e..f3cc5f5b 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.h +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.h @@ -12,6 +12,10 @@ NS_ASSUME_NONNULL_BEGIN @interface XPMineGiveDiamondCell : UITableViewCell @property (nonatomic,strong) XPMineGiveDiamondModel *giveDiamondModel; + +@property(nonatomic, copy) void(^handleTapTransfer)(XPMineGiveDiamondModel *giveDiamondModel); +@property(nonatomic, copy) void(^handleTapHistory)(XPMineGiveDiamondModel *giveDiamondModel); + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.m index 9f7abd8c..12da92be 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondCell.m @@ -18,7 +18,8 @@ /// id @property (nonatomic,strong) UILabel * IdTitleView; -@property (nonatomic,strong) UIImageView *arrowView; +@property(nonatomic, strong) UIButton *transferButton; +@property(nonatomic, strong) UIButton *historyButton; @end @@ -40,10 +41,11 @@ - (void)initSubViews { self.backgroundColor = [UIColor clearColor]; self.selectionStyle = 0; - [self addSubview:self.headView]; - [self addSubview:self.titleView]; - [self addSubview:self.IdTitleView]; - [self addSubview:self.arrowView]; + [self.contentView addSubview:self.headView]; + [self.contentView addSubview:self.titleView]; + [self.contentView addSubview:self.IdTitleView]; + [self.contentView addSubview:self.transferButton]; + [self.contentView addSubview:self.historyButton]; } - (void)initSubViewConstraints { @@ -57,7 +59,7 @@ make.leading.equalTo(self.headView.mas_trailing).mas_offset( kGetScaleWidth(10)); make.height.mas_equalTo(kGetScaleWidth(17)); make.top.equalTo(self.headView.mas_top).mas_offset(kGetScaleWidth(8)); - make.trailing.mas_equalTo(-kGetScaleWidth(15)); + make.trailing.mas_equalTo(self.transferButton.mas_leading).offset(-4); }]; [self.IdTitleView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -66,22 +68,33 @@ make.top.equalTo(self.titleView.mas_bottom).mas_offset(kGetScaleWidth(4)); }]; - [self.arrowView mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.height.mas_equalTo(kGetScaleWidth(20)); - make.centerY.equalTo(self); - make.trailing.mas_equalTo(-kGetScaleWidth(15)); + [self.historyButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.equalTo(self).offset(-15); + make.height.mas_equalTo(30); + make.width.mas_equalTo(68); + make.centerY.equalTo(self.headView); }]; - UIView *line = [[UIView alloc] init]; - line.backgroundColor = UIColorFromRGB(0xe4e4e4); - [self addSubview: line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.mas_equalTo(self); - make.leading.mas_equalTo(self.headView); - make.trailing.mas_equalTo(self.arrowView); - make.height.mas_equalTo(0.5); + [self.transferButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.equalTo(self.historyButton.mas_leading).offset(-10); + make.height.mas_equalTo(30); + make.width.mas_equalTo(68); + make.centerY.equalTo(self.headView); }]; } + +- (void)didTapTransfer { + if (_handleTapTransfer) { + self.handleTapTransfer(self.giveDiamondModel); + } +} + +- (void)didTapHistory { + if (_handleTapHistory) { + self.handleTapHistory(self.giveDiamondModel); + } +} + #pragma mark - 懒加载 - (NetImageView *)headView{ if (!_headView){ @@ -109,12 +122,31 @@ } return _IdTitleView; } -- (UIImageView *)arrowView{ - if (!_arrowView){ - _arrowView = [UIImageView new]; - _arrowView.image = [[UIImage imageNamed:@"grey_right_arrow"] ms_SetImageForRTL]; + +- (UIButton *)transferButton { + if (!_transferButton) { + _transferButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_transferButton.titleLabel setFont:kFontMedium(13)]; + [_transferButton setTitle:YMLocalizedString(@"1.0.37_text_46") forState:UIControlStateNormal]; + [_transferButton setTitleColor:UIColorFromRGB(0xCD6300) forState:UIControlStateNormal]; + [_transferButton setBackgroundColor:UIColorFromRGB(0xFFEFDC)]; + [_transferButton addTarget:self action:@selector(didTapTransfer) forControlEvents:UIControlEventTouchUpInside]; + [_transferButton setCornerRadius:15]; } - return _arrowView; + return _transferButton; +} + +- (UIButton *)historyButton { + if (!_historyButton) { + _historyButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_historyButton.titleLabel setFont:kFontMedium(13)]; + [_historyButton setTitle:YMLocalizedString(@"1.0.37_text_47") forState:UIControlStateNormal]; + [_historyButton setTitleColor:UIColorFromRGB(0x3b70c8) forState:UIControlStateNormal]; + [_historyButton setBackgroundColor:UIColorFromRGB(0xe4eeff)]; + [_historyButton addTarget:self action:@selector(didTapHistory) forControlEvents:UIControlEventTouchUpInside]; + [_historyButton setCornerRadius:15]; + } + return _historyButton; } @end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsCell.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsCell.m index 0635ee56..53c4b2b2 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsCell.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsCell.m @@ -8,18 +8,23 @@ #import "XPMineGiveDiamondDetailsCell.h" #import "NetImageView.h" #import "NSDate+DateUtils.h" +#import "MoliMoneyLabel.h" @interface XPMineGiveDiamondDetailsCell() ///礼物/钻石图标 @property (nonatomic,strong) NetImageView * avatarImageView; ///礼物标题 @property (nonatomic,strong) UILabel *titleLabel; ///时间 -@property (nonatomic,strong) UILabel *timeLabel; +@property (nonatomic,strong) UILabel *timeLabel; ///转赠钻石数量 @property (nonatomic,strong) UILabel *contentLabel; ///转赠钻石支出 @property (nonatomic,strong) UILabel *spendingView; +@property (nonatomic,strong) UILabel *idLabel; + +@property(nonatomic, strong) MoliMoneyLabel *moneyLabel; + @end @implementation XPMineGiveDiamondDetailsCell @@ -41,6 +46,8 @@ [self.contentView addSubview:self.timeLabel]; [self.contentView addSubview:self.contentLabel]; [self.contentView addSubview:self.spendingView]; + [self.contentView addSubview:self.moneyLabel]; + [self.contentView addSubview:self.idLabel]; } - (void)initSubViewConstraints { [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -52,19 +59,13 @@ [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(kGetScaleWidth(65)); make.top.mas_equalTo(self.avatarImageView).offset(3); - make.trailing.equalTo(self.timeLabel.mas_leading).mas_offset(-kGetScaleWidth(10)); - }]; - - [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.trailing.mas_equalTo(-kGetScaleWidth(15)); - make.centerY.equalTo(self.contentLabel); }]; [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.top.equalTo(self.avatarImageView.mas_top).mas_offset(3); make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(10); make.height.mas_equalTo(kGetScaleWidth(21)); - make.trailing.equalTo(self.timeLabel.mas_leading).mas_offset(-kGetScaleWidth(10)); + make.trailing.equalTo(self.moneyLabel.mas_leading).mas_offset(-10); }]; [self.spendingView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.equalTo(self.contentLabel); @@ -73,15 +74,23 @@ make.height.mas_equalTo(kGetScaleWidth(14)); }]; - UIView *line = [[UIView alloc] init]; - line.backgroundColor = UIColorFromRGB(0xe4e4e4); - [self addSubview: line]; - [line mas_makeConstraints:^(MASConstraintMaker *make) { - make.bottom.mas_equalTo(self); - make.leading.mas_equalTo(self.avatarImageView); - make.trailing.mas_equalTo(self.timeLabel); - make.height.mas_equalTo(0.5); + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.contentLabel); + make.top.mas_equalTo(self.contentLabel.mas_bottom).offset(3); + make.height.mas_equalTo(20); }]; + + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(-15); + make.top.mas_equalTo(self.titleLabel); + make.height.mas_equalTo(22); + make.width.mas_greaterThanOrEqualTo(30); + }]; + + // 设置 label 优先级,确保右边的 label 能够完整显示 + [self.moneyLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + [self.titleLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; + } #pragma mark - 赋值 - (void)setModel:(XPMineGiveDiamondDetailsModel *)model{ @@ -97,17 +106,25 @@ if(self.model.type.intValue == 0){ // 转赠钻石 + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(-kGetScaleWidth(15)); + make.bottom.equalTo(self.contentView).offset(-15); + }]; + self.moneyLabel.hidden = NO; self.titleLabel.hidden = YES; self.contentLabel.hidden = NO; - self.spendingView.hidden = NO; + self.idLabel.hidden = NO; + self.idLabel.text = [NSString stringWithFormat:@"ID:%@", self.model.targetUid]; self.avatarImageView.image = [UIImage imageNamed:@"moli_money_icon"]; self.avatarImageView.imageUrl = self.model.targetAvatar; self.contentLabel.text = self.model.targetNick; self.timeLabel.text = [NSDate timestampSwitchTime:self.model.createTime/1000 andFormatter:@"yyyy-MM-dd HH:mm:ss"]; - NSString *realDiamondNum = [NSString stringWithFormat:@"%.2f",self.model.realDiamondNum]; - self.spendingView.text = [NSString stringWithFormat:YMLocalizedString(@"XPMineGiveDiamondDetailsCell0"),realDiamondNum]; + [self.moneyLabel updateContent:[NSString stringWithFormat:@"-%@", self.model.diamondNum]]; } else { - // 转赠礼物 + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(-kGetScaleWidth(15)); + make.centerY.equalTo(self.contentLabel); + }]; self.avatarImageView.image = [UIImageConstant defaultAvatarPlaceholder]; self.avatarImageView.imageUrl = self.model.giftUrl; self.titleLabel.text = [NSString stringWithFormat:@"%@ x%@",self.model.giftName,self.model.giftNum]; @@ -125,7 +142,7 @@ _avatarImageView.backgroundColor = UIColorFromRGB(0xF3F5FA); _avatarImageView.layer.cornerRadius = kGetScaleWidth(49)/2; _avatarImageView.clipsToBounds = YES; - _avatarImageView.contentMode = UIViewContentModeScaleAspectFit; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; } return _avatarImageView; } @@ -170,4 +187,23 @@ return _spendingView; } +- (MoliMoneyLabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0xFF8C03) + font:kFontSemibold(16) + moneyPostion:2 + moneySize:CGSizeMake(22, 22)]; + _moneyLabel.hidden = YES; + } + return _moneyLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [UILabel labelInitWithText:@"" font:kFontRegular(13) textColor:UIColorFromRGB(0x7b7b7d)]; + _idLabel.hidden = YES; + } + return _idLabel; +} + @end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsView.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsView.m index e551e37c..d7bdfea6 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsView.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/Cell/XPMineGiveDiamondDetailsView.m @@ -72,7 +72,8 @@ _tableView.delegate = self; _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15); + _tableView.separatorColor = UIColorFromRGB(0xf7f7f7); _tableView.backgroundColor = [UIColor clearColor]; [_tableView registerClass:[XPMineGiveDiamondDetailsCell class] forCellReuseIdentifier:NSStringFromClass([XPMineGiveDiamondDetailsCell class])]; [_tableView registerClass:[XPMineFriendEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])]; diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.h b/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.h new file mode 100644 index 00000000..357b053b --- /dev/null +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.h @@ -0,0 +1,18 @@ +// +// RechargerTransferHistoryViewController.h +// YuMi +// +// Created by P on 2025/2/25. +// + +#import "MvpViewController.h" +@class UserInfoModel; +NS_ASSUME_NONNULL_BEGIN + +@interface RechargerTransferHistoryViewController : MvpViewController + +- (instancetype)initWithUserInfo:(UserInfoModel *)userInfo; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.m new file mode 100644 index 00000000..090c7c0d --- /dev/null +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/RechargerTransferHistoryViewController.m @@ -0,0 +1,538 @@ +// +// RechargerTransferHistoryViewController.m +// YuMi +// +// Created by P on 2025/2/25. +// + +#import "RechargerTransferHistoryViewController.h" +#import "MoliMoneyLabel.h" +#import "UserInfoModel.h" +#import "RechargeUserModel.h" +#import "XPMineGiveDiamondPresenter.h" +#import "XPMineGiveDiamondProtocol.h" + +@interface RechargerTransferHistoryCell : UITableViewCell +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UILabel *nameLabel; +@property(nonatomic, strong) UILabel *idLabel; +@property(nonatomic, strong) MoliMoneyLabel *moneyLabel; +@property(nonatomic, strong) UILabel *timeLabel; +@property(nonatomic, strong) DiamondGiveHistoryVo *cellModel; +@property(nonatomic, strong) UILabel *settlementLabel; +@property(nonatomic, assign) BOOL isArabia; + +@end + +@implementation RechargerTransferHistoryCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor whiteColor]; + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self.contentView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.leading.mas_equalTo(16); + make.size.mas_equalTo(49); + }]; + + [self.contentView addSubview:self.nameLabel]; + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_top).offset(3); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(11); + make.height.mas_equalTo(18); + }]; + + [self.contentView addSubview:self.idLabel]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self.contentView).offset(-12); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(11); + make.height.mas_equalTo(18); + }]; + + [self.contentView addSubview:self.moneyLabel]; + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.nameLabel); + make.trailing.mas_equalTo(self.contentView).offset(-16); + make.height.mas_equalTo(22); + make.width.mas_greaterThanOrEqualTo(30); + }]; + + [self.contentView addSubview:self.settlementLabel]; + [self.settlementLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.moneyLabel); + make.trailing.mas_equalTo(self.moneyLabel.mas_leading).offset(-4); + make.height.mas_equalTo(18); + }]; + + [self.contentView addSubview:self.timeLabel]; + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.moneyLabel.mas_bottom).offset(8); + make.trailing.mas_equalTo(self.moneyLabel); + make.height.mas_equalTo(18); + }]; + + // 设置 label 优先级,确保右边的 label 能够完整显示 + [self.moneyLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal]; + [self.settlementLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; + } + return self; +} + +- (void)setIsArabia:(BOOL)isArabia { + _isArabia = isArabia; +} + +- (void)updateCellModel:(DiamondGiveHistoryVo *)cellModel isDisplayÜS:(BOOL)isDisplayÜS { + _cellModel = cellModel; + + self.avatarImageView.imageUrl = cellModel.targetAvatar; + self.nameLabel.text = cellModel.targetNick; + self.idLabel.text = [NSString stringWithFormat:@"ID: %@", @(cellModel.targetUid)]; + [self.moneyLabel updateContent: [NSString stringWithFormat:@"%@", @(cellModel.diamondNum)]]; + self.timeLabel.text = cellModel.createTimeStr; + if (self.isArabia) { +// self.settlementLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_48"), cellModel.]; + if (isDisplayÜS) { + [self.moneyLabel updateFont:kFontRegular(12) size:CGSizeMake(13, 13)]; + } else { + [self.moneyLabel updateFont:kFontSemibold(16) size:CGSizeMake(22, 22)]; + } + } +} + +#pragma mark - +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + _avatarImageView = [[NetImageView alloc] init]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setCornerRadius:kGetScaleWidth(49/2)]; + } + return _avatarImageView; +} + +- (UILabel *)nameLabel { + if (!_nameLabel) { + _nameLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(15) textColor:UIColorFromRGB(0x313131)]; + } + return _nameLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [UILabel labelInitWithText:@"" font:kFontRegular(13) textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _idLabel; +} + +- (MoliMoneyLabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0xFF8C03) font:kFontSemibold(16) moneyPostion:2 moneySize:CGSizeMake(22, 22)]; + } + return _moneyLabel; +} + +- (UILabel *)timeLabel { + if (!_timeLabel) { + _timeLabel = [UILabel labelInitWithText:@"" font:kFontRegular(13) textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _timeLabel; +} + +- (UILabel *)settlementLabel { + if (!_settlementLabel) { + _settlementLabel = [UILabel labelInitWithText:@"" font:kFontMedium(13) textColor:UIColorFromRGB(0x313131)]; + } + return _settlementLabel; +} + +@end + +@interface RechargerTransferHistoryViewController () + +@property(nonatomic, strong) UserInfoModel *userInfo; + +@property(nonatomic, strong) UIButton *thisCycleButton; +@property(nonatomic, strong) UIButton *lastCycleButton; +@property(nonatomic, strong) UIView *topSelectedTab; +@property(nonatomic, strong) UILabel *durationsLabel; +@property(nonatomic, strong) UIButton *ÜSSettlementButton; +@property(nonatomic, strong) UIButton *transferCoinsButton; +@property(nonatomic, strong) UILabel *totalAmountTitleLabel; +@property(nonatomic, strong) UILabel *amountLabel; +@property(nonatomic, strong) MoliMoneyLabel *moliAmountLabel; +@property(nonatomic, strong) UITableView *historyTableView; + +@property(nonatomic, assign) NSInteger periodType; // 1: this, 2: last +@property(nonatomic, assign) NSInteger transferType; // 1-金币转赠历史,2-代发薪资历史 + +//@property(nonatomic, strong) NSMutableArray */*dataSource*/; +@property(nonatomic, strong) DiamondHistoryModel *dataSourceModel; +@property(nonatomic, copy) NSArray *sectionTitles; +@property(nonatomic, copy) NSArray *sectionData; +@property(nonatomic, strong) NSMutableArray *originalDiamondGiveHistoryVoList; + +@property(nonatomic, assign) NSInteger page; + +@end + +@implementation RechargerTransferHistoryViewController + +- (XPMineGiveDiamondPresenter *)createPresenter { + return [[XPMineGiveDiamondPresenter alloc] init]; +} + +- (instancetype)initWithUserInfo:(UserInfoModel *)userInfo { + if (self = [super init]) { + self.userInfo = userInfo; + } + return self; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.page = 1; + self.periodType = 1; + self.transferType = 1; + + self.title = YMLocalizedString(@"1.0.37_text_41"); + self.view.backgroundColor = [UIColor whiteColor]; + + [self.view addSubview:self.thisCycleButton]; + [self.view addSubview:self.lastCycleButton]; + [self.thisCycleButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(8); + make.leading.mas_equalTo(16); + make.height.mas_equalTo(24); + }]; + [self.lastCycleButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(8); + make.leading.mas_equalTo(self.thisCycleButton.mas_trailing).offset(30); + make.height.mas_equalTo(24); + }]; + + [self.view addSubview:self.durationsLabel]; + [self.durationsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.thisCycleButton.mas_bottom).offset(21); + make.leading.mas_equalTo(self.thisCycleButton); + make.height.mas_equalTo(18); + }]; + + if ([self.userInfo isArabia]) { + self.transferType = 2; + [self.moliAmountLabel displayIcon:NO]; + self.ÜSSettlementButton.selected = YES; + self.transferCoinsButton.selected = NO; + UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.ÜSSettlementButton, + self.transferCoinsButton + ]]; + stack.backgroundColor = UIColorFromRGB(0xf7f7f7); + [stack setCornerRadius:16]; + [self.view addSubview:stack]; + [stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.durationsLabel.mas_bottom).offset(13); + make.leading.trailing.mas_equalTo(self.view).inset(16); + make.height.mas_equalTo(32); + }]; + [self.ÜSSettlementButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(stack.mas_width).multipliedBy(0.5); + make.height.mas_equalTo(stack.mas_height); + }]; + [self.transferCoinsButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(stack.mas_width).multipliedBy(0.5); + make.height.mas_equalTo(stack.mas_height); + }]; + } + + [self.view addSubview:self.totalAmountTitleLabel]; + [self.totalAmountTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.durationsLabel.mas_bottom).offset([self.userInfo isArabia] ? 56 : 12); + make.leading.mas_equalTo(self.durationsLabel); + make.height.mas_equalTo(22); + }]; + + [self.view addSubview:self.moliAmountLabel]; + [self.moliAmountLabel updateContent:@""]; + [self.moliAmountLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.totalAmountTitleLabel.mas_bottom).offset(9); + make.leading.mas_equalTo(self.totalAmountTitleLabel); + }]; + + [self.view addSubview:self.historyTableView]; + [self.historyTableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.moliAmountLabel.mas_bottom).offset(16); + make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight); + make.leading.trailing.mas_equalTo(self.view); + }]; + + [self reloadAPI]; +} + +- (void)reloadAPI { + [self.presenter userTransferHistory:self.periodType page:self.page type:self.transferType]; +} + +#pragma mark - +- (void)didTapThisCycle { + if (self.thisCycleButton.isSelected) { + return; + } + self.thisCycleButton.selected = YES; + self.lastCycleButton.selected = NO; + + self.page = 1; + self.periodType = 1; + [self reloadAPI]; +} + +- (void)didTapLastCycle { + if (self.lastCycleButton.isSelected) { + return; + } + self.thisCycleButton.selected = NO; + self.lastCycleButton.selected = YES; + + self.page = 1; + self.periodType = 2; + [self reloadAPI]; +} + +- (void)didTapÜSSettlement { + if (self.ÜSSettlementButton.isSelected) { + return; + } + self.ÜSSettlementButton.selected = YES; + self.transferCoinsButton.selected = NO; + [self.moliAmountLabel displayIcon:NO]; + self.page = 1; + self.transferType = 2; + [self reloadAPI]; +} + +- (void)didTapTransferCoins { + if (self.transferCoinsButton.isSelected) { + return; + } + self.ÜSSettlementButton.selected = NO; + self.transferCoinsButton.selected = YES; + [self.moliAmountLabel displayIcon:YES]; + self.page = 1; + self.transferType = 1; + [self reloadAPI]; +} + +- (void)footerRefresh { + self.page++; + [self reloadAPI]; +} + +#pragma mark - +- (void)loadTransferHistorySuccess:(DiamondHistoryModel *)infos { + self.dataSourceModel = infos; + self.durationsLabel.text = infos.cycleDateStr; + if ([self.userInfo isArabia] && self.transferType == 2) { + [self.moliAmountLabel updateContent:[NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_49"), @(infos.totalGiveGoldUsd)]]; + } else { + [self.moliAmountLabel updateContent:@(infos.totalGiveGold).stringValue]; + } + + if (self.page == 1) { + self.originalDiamondGiveHistoryVoList = @[].mutableCopy; + } else { + [self.historyTableView.mj_footer endRefreshing]; + } + + if (infos.diamondGiveHistoryVoList.count == 0) { + [self.historyTableView.mj_footer endRefreshingWithNoMoreData]; + if (self.page > 1) { + return; + } + } + + [self.originalDiamondGiveHistoryVoList addObjectsFromArray:infos.diamondGiveHistoryVoList]; + + // Step 1: 按日期进行分组 + NSMutableDictionary *groupedData = [NSMutableDictionary dictionary]; + + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + dateFormatter.dateFormat = @"yyyy-MM-dd"; + + for (DiamondGiveHistoryVo *history in self.originalDiamondGiveHistoryVoList) { + // 将 createTime 转换为 NSDate + NSDate *date = [NSDate dateWithTimeIntervalSince1970:history.createTime/1000]; + NSString *dateString = [dateFormatter stringFromDate:date]; + + // 根据日期字符串分组 + if (!groupedData[dateString]) { + groupedData[dateString] = [NSMutableArray array]; + } + [groupedData[dateString] addObject:history]; + } + + // Step 2: 将分组后的数据转换为一个数组,供 tableView 使用 + self.sectionTitles = [groupedData allKeys]; + self.sectionData = [groupedData allValues]; + + // 刷新 tableView 数据 + [self.historyTableView reloadData]; +} + +#pragma mark - +- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { + return self.sectionTitles.count; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return [self.sectionData[section] count]; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { + return 38; +} + +- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { + UIView *container = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 38)]; + container.backgroundColor = UIColorFromRGB(0xf4f4f4); + UILabel *label = [UILabel labelInitWithText:self.sectionTitles[section] + font:kFontMedium(14) + textColor:UIColorFromRGB(0x313131)]; + [container addSubview:label]; + [label mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(container); + make.leading.mas_equalTo(15); + make.height.mas_equalTo(20); + }]; + return container; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 72; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + RechargerTransferHistoryCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RechargerTransferHistoryCell" forIndexPath:indexPath]; + cell.isArabia = [self.userInfo isArabia]; + DiamondGiveHistoryVo *history = self.sectionData[indexPath.section][indexPath.row]; + + [cell updateCellModel:history isDisplayÜS:self.transferType == 2]; + return cell; +} + +#pragma mark - +- (UIButton *)thisCycleButton { + if (!_thisCycleButton) { + _thisCycleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_thisCycleButton.titleLabel setFont:kFontMedium(16)]; + [_thisCycleButton setTitle:YMLocalizedString(@"1.0.37_text_42") forState:UIControlStateNormal]; + [_thisCycleButton setTitle:YMLocalizedString(@"1.0.37_text_42") forState:UIControlStateSelected]; + [_thisCycleButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateSelected]; + [_thisCycleButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal]; + [_thisCycleButton addTarget:self action:@selector(didTapThisCycle) forControlEvents:UIControlEventTouchUpInside]; + [_thisCycleButton setSelected:YES]; + } + return _thisCycleButton; +} + +- (UIButton *)lastCycleButton { + if (!_lastCycleButton) { + _lastCycleButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_lastCycleButton.titleLabel setFont:kFontMedium(16)]; + [_lastCycleButton setTitle:YMLocalizedString(@"1.0.37_text_43") forState:UIControlStateNormal]; + [_lastCycleButton setTitle:YMLocalizedString(@"1.0.37_text_43") forState:UIControlStateSelected]; + [_lastCycleButton setTitleColor:UIColorFromRGB(0x313131) forState:UIControlStateSelected]; + [_lastCycleButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal]; + [_lastCycleButton addTarget:self action:@selector(didTapLastCycle) forControlEvents:UIControlEventTouchUpInside]; + } + return _lastCycleButton; +} + +- (UILabel *)durationsLabel { + if (!_durationsLabel) { + _durationsLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _durationsLabel; +} + +- (UIButton *)ÜSSettlementButton { + if (!_ÜSSettlementButton) { + _ÜSSettlementButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_ÜSSettlementButton.titleLabel setFont:kFontMedium(13)]; + [_ÜSSettlementButton setTitle:YMLocalizedString(@"1.0.37_text_38") forState:UIControlStateNormal]; + [_ÜSSettlementButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal]; + [_ÜSSettlementButton setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateSelected]; + [_ÜSSettlementButton setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateNormal]; + [_ÜSSettlementButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xff8c03)] forState:UIControlStateSelected]; + [_ÜSSettlementButton setCornerRadius:16]; + [_ÜSSettlementButton addTarget:self action:@selector(didTapÜSSettlement) forControlEvents:UIControlEventTouchUpInside]; + [_ÜSSettlementButton setSelected:YES]; + } + return _ÜSSettlementButton; +} + +- (UIButton *)transferCoinsButton { + if (!_transferCoinsButton) { + _transferCoinsButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_transferCoinsButton.titleLabel setFont:kFontMedium(13)]; + [_transferCoinsButton setTitle:YMLocalizedString(@"1.0.37_text_34") forState:UIControlStateNormal]; + [_transferCoinsButton setTitleColor:UIColorFromRGB(0xafb1b3) forState:UIControlStateNormal]; + [_transferCoinsButton setTitleColor:UIColorFromRGB(0xffffff) forState:UIControlStateSelected]; + [_transferCoinsButton setBackgroundImage:[UIImage imageWithColor:[UIColor clearColor]] forState:UIControlStateNormal]; + [_transferCoinsButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0xff8c03)] forState:UIControlStateSelected]; + [_transferCoinsButton setCornerRadius:16]; + [_transferCoinsButton addTarget:self action:@selector(didTapTransferCoins) forControlEvents:UIControlEventTouchUpInside]; + } + return _transferCoinsButton; +} + +- (UILabel *)totalAmountTitleLabel { + if (!_totalAmountTitleLabel) { + _totalAmountTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_44") + font:kFontMedium(14) + textColor:UIColorFromRGB(0x313131)]; + } + return _totalAmountTitleLabel; +} + +- (UILabel *)amountLabel { + if (!_amountLabel) { + _amountLabel = [UILabel labelInitWithText:@"" + font:kFontSemibold(26) + textColor:UIColorFromRGB(0xFF8C03)]; + } + return _amountLabel; +} + +- (MoliMoneyLabel *)moliAmountLabel { + if (!_moliAmountLabel) { + _moliAmountLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0xFF8C03) + font:kFontSemibold(26) + moneyPostion:2 + moneySize:CGSizeMake(30, 30)]; + } + return _moliAmountLabel; +} + +- (UITableView *)historyTableView { + if (!_historyTableView) { + _historyTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _historyTableView.delegate = self; + _historyTableView.dataSource = self; + _historyTableView.separatorColor = UIColorFromRGB(0xf4f4f4); + _historyTableView.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15); + _historyTableView.backgroundColor = [UIColor clearColor]; + _historyTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + _historyTableView.contentInset = UIEdgeInsetsZero; + [_historyTableView registerClass:[RechargerTransferHistoryCell class] forCellReuseIdentifier:@"RechargerTransferHistoryCell"]; + + MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)]; + footer.stateLabel.textColor = [DJDKMIMOMColor secondTextColor]; + footer.stateLabel.font = [UIFont systemFontOfSize:10.0]; + _historyTableView.mj_footer = footer; + } + return _historyTableView; +} + +@end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.h b/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.h new file mode 100644 index 00000000..f09f352f --- /dev/null +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.h @@ -0,0 +1,16 @@ +// +// SubRechargersViewController.h +// YuMi +// +// Created by P on 2025/2/25. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface SubRechargersViewController : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.m new file mode 100644 index 00000000..5f445bdc --- /dev/null +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/SubRechargersViewController.m @@ -0,0 +1,323 @@ +// +// SubRechargersViewController.m +// YuMi +// +// Created by P on 2025/2/25. +// + +#import "SubRechargersViewController.h" +#import "XPMineGiveDiamondPresenter.h" +#import "RechargeUserModel.h" +#import "MoliMoneyLabel.h" + +@interface SubRechargersCell : UITableViewCell + +@property(nonatomic, strong) SubRechargeUserModel *cellModel; + +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UILabel *nameLabel; +@property(nonatomic, strong) UILabel *idLabel; +@property(nonatomic, strong) UIStackView *starsStack; +@property(nonatomic, strong) UIButton *star_1; +@property(nonatomic, strong) UIButton *star_2; +@property(nonatomic, strong) UIButton *star_3; +@property(nonatomic, strong) UIButton *star_4; +@property(nonatomic, strong) UIButton *star_5; +@property(nonatomic, strong) UILabel *lastTransferDateLabel; +@property(nonatomic, strong) MoliMoneyLabel *totalCostLabel; + +@end + +@implementation SubRechargersCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + self.selectionStyle = UITableViewCellSelectionStyleNone; + + UIView *container = [[UIView alloc] init]; + container.backgroundColor = UIColorFromRGB(0xf4f4f4); + [container setCornerRadius:8]; + [self.contentView addSubview:container]; + [container mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.contentView); + make.height.mas_equalTo(80); + }]; + + [container addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(13); + make.leading.mas_equalTo(9); + make.size.mas_equalTo(CGSizeMake(55, 55)); + }]; + + [container addSubview:self.nameLabel]; + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(11); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(12); + make.height.mas_equalTo(24); + }]; + + [container addSubview:self.idLabel]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel.mas_bottom); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(12); + make.height.mas_equalTo(18); + }]; + + [container addSubview:self.starsStack]; + [self.starsStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(12); + make.top.mas_equalTo(self.idLabel.mas_bottom).offset(2); + make.height.mas_equalTo(15); + }]; + + [self.star_1 mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + [self.star_2 mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + [self.star_3 mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + [self.star_4 mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + [self.star_5 mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(15, 15)); + }]; + + [container addSubview:self.lastTransferDateLabel]; + [self.lastTransferDateLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nameLabel); + make.trailing.mas_equalTo(container).offset(-9); + make.height.mas_equalTo(18); + }]; + + [container addSubview:self.totalCostLabel]; + [self.totalCostLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.avatarImageView); + make.trailing.mas_equalTo(container).offset(-9); + make.height.mas_equalTo(22); + }]; + } + return self; +} + +- (void)setCellModel:(SubRechargeUserModel *)cellModel { + _cellModel = cellModel; + self.avatarImageView.imageUrl = cellModel.avatar; + self.nameLabel.text = cellModel.nick; + self.idLabel.text = [NSString stringWithFormat:@"ID:%@", @(cellModel.uid)]; + [self.totalCostLabel updateContent:@(cellModel.totalGiveGold).stringValue]; + + [self.star_1 setSelected:NO]; + [self.star_2 setSelected:NO]; + [self.star_3 setSelected:NO]; + [self.star_4 setSelected:NO]; + [self.star_5 setSelected:NO]; + if (cellModel.starLevel > 0) { + [self.star_1 setSelected:YES]; + } + if (cellModel.starLevel > 1) { + [self.star_2 setSelected:YES]; + } + if (cellModel.starLevel > 2) { + [self.star_3 setSelected:YES]; + } + if (cellModel.starLevel > 3) { + [self.star_4 setSelected:YES]; + } + if (cellModel.starLevel > 4) { + [self.star_5 setSelected:YES]; + } +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + _avatarImageView = [[NetImageView alloc] init]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setCornerRadius:55/2]; + } + return _avatarImageView; +} + +- (UILabel *)nameLabel { + if (!_nameLabel) { + _nameLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(15) textColor:UIColorFromRGB(0x313131)]; + } + return _nameLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [UILabel labelInitWithText:@"" font:kFontRegular(13) textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _idLabel; +} + +- (UILabel *)lastTransferDateLabel { + if (!_lastTransferDateLabel) { + _lastTransferDateLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_40") + font:kFontRegular(12) + textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _lastTransferDateLabel; +} + +- (MoliMoneyLabel *)totalCostLabel { + if (!_totalCostLabel) { + _totalCostLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0xff8c03) + font:kFontSemibold(16) + moneyPostion:2 + moneySize:CGSizeMake(22, 22)]; + } + return _totalCostLabel; +} + +- (UIStackView *)starsStack { + if (!_starsStack) { + _starsStack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.star_1, + self.star_2, + self.star_3, + self.star_4, + self.star_5, + ]]; + _starsStack.spacing = 4; + } + return _starsStack; +} + +- (UIButton *)star_1 { + if (!_star_1) { + _star_1 = [UIButton buttonWithType:UIButtonTypeCustom]; + [_star_1 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal]; + [_star_1 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected]; + } + return _star_1; +} +- (UIButton *)star_2 { + if (!_star_2) { + _star_2 = [UIButton buttonWithType:UIButtonTypeCustom]; + [_star_2 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal]; + [_star_2 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected]; + } + return _star_2; +} +- (UIButton *)star_3 { + if (!_star_3) { + _star_3 = [UIButton buttonWithType:UIButtonTypeCustom]; + [_star_3 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal]; + [_star_3 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected]; + } + return _star_3; +} +- (UIButton *)star_4 { + if (!_star_4) { + _star_4 = [UIButton buttonWithType:UIButtonTypeCustom]; + [_star_4 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal]; + [_star_4 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected]; + } + return _star_4; +} +- (UIButton *)star_5 { + if (!_star_5) { + _star_5 = [UIButton buttonWithType:UIButtonTypeCustom]; + [_star_5 setBackgroundImage:kImage(@"star_white") forState:UIControlStateNormal]; + [_star_5 setBackgroundImage:kImage(@"star_yellow") forState:UIControlStateSelected]; + } + return _star_5; +} + +@end + +@interface SubRechargersViewController () + +@property(nonatomic, copy) NSArray *dataSource; +@property(nonatomic, strong) UITableView *tableView; +@property(nonatomic, strong) UIImageView *emptyImageView; + +@end + +@implementation SubRechargersViewController + +- (XPMineGiveDiamondPresenter *)createPresenter { + return [[XPMineGiveDiamondPresenter alloc] init]; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.title = YMLocalizedString(@"1.0.37_text_39"); + self.view.backgroundColor = [UIColor whiteColor]; + + [self setupUI]; + [self.presenter subrechargeInfoList]; +} + +- (void)setupUI { + [self.view addSubview:self.tableView]; + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.view).insets(UIEdgeInsetsMake(18, 15, 18, 15)); + }]; + + [self.view addSubview:self.emptyImageView]; + [self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.view).offset(150); + make.centerX.mas_equalTo(self.view); + make.size.mas_equalTo(CGSizeMake(200, 200)); + }]; +} + +#pragma mark - XPMineGiveDiamondProtocol +- (void)loadSubRechargerInfoSuccess:(NSArray *)infos { + self.dataSource = infos; + [self.tableView reloadData]; + if (infos.count == 0) { + self.emptyImageView.hidden = NO; + } +} + +#pragma mark - UITableView DataSource & Delegate +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.dataSource.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 94; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + SubRechargersCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SubRechargersCell" forIndexPath:indexPath]; + cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row]; + return cell; +} + +#pragma mark - +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = [UIColor clearColor]; + [_tableView registerClass:[SubRechargersCell class] forCellReuseIdentifier:@"SubRechargersCell"]; + } + return _tableView; +} + +- (UIImageView *)emptyImageView { + if (!_emptyImageView) { + _emptyImageView = [[UIImageView alloc] init]; + _emptyImageView.hidden = YES; + _emptyImageView.userInteractionEnabled = YES; + _emptyImageView.image = [UIImageConstant defaultEmptyPlaceholder_UFO]; + _emptyImageView.layer.masksToBounds = YES; + _emptyImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _emptyImageView; +} + +@end diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.h b/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.h index 8fa693f0..5829ac7c 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.h +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.h @@ -11,7 +11,10 @@ NS_ASSUME_NONNULL_BEGIN @interface XPMineGiveDiamondVC : MvpViewController -@property (nonatomic,strong) UserInfoModel *userInfo; + + +- (instancetype)initWithUserModel:(UserInfoModel *)userInfo; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.m b/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.m index 90dea1f2..0fe45966 100644 --- a/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.m +++ b/YuMi/Modules/YMMine/View/GiveDiamond/View/XPMineGiveDiamondVC.m @@ -26,12 +26,24 @@ #import "RechargeUserModel.h" +#import "SubRechargersViewController.h" +#import "RechargerTransferHistoryViewController.h" + @interface XPMineGiveDiamondVC () @property (nonatomic,strong) UITableView *tableView; - @property(nonatomic, strong) UIView *infoContainer; @property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UILabel *transferCoinsLabel; +@property(nonatomic, strong) UILabel *transferCoinsTitleLabel; +@property(nonatomic, strong) UILabel *ÜSSettlementLabel; +@property(nonatomic, strong) UILabel *ÜSSettlementTitleLabel; +@property(nonatomic, strong) UIImageView *moneyIcon; +@property(nonatomic, strong) UIButton *viewDetailButton; +@property(nonatomic, strong) UIButton *subRechargeButton; +@property(nonatomic, strong) UILabel *subRechargeTitleLabel; +@property(nonatomic, strong) UILabel *subRechargeNumLabel; @property(nonatomic, strong) UILabel *nameLabel; +@property(nonatomic, strong) UILabel *recentTransfersTitleLabel; @property(nonatomic, strong) NetImageView *icon1ImageView; @property(nonatomic, strong) NetImageView *icon2ImageView; @property(nonatomic, strong) UILabel *idLabel; @@ -47,21 +59,37 @@ @property (nonatomic,strong) XPMineGiveDiamondSearchView *searchView; ///数据源 @property (nonatomic,strong) NSMutableArray *datasource; -//@property (nonatomic,strong) UIView *headView; + ///搜索的id @property (nonatomic,copy) NSString *text; ///显示tag @property (nonatomic,strong) UILabel *tagView; + +@property (nonatomic,strong) UserInfoModel *userInfo; + @end @implementation XPMineGiveDiamondVC + +- (instancetype)initWithUserModel:(UserInfoModel *)userInfo { + if (self = [super init]) { + self.userInfo = userInfo; + } + return self; +} + - (XPMineGiveDiamondPresenter *)createPresenter { return [[XPMineGiveDiamondPresenter alloc] init]; } + - (void)viewDidLoad { [super viewDidLoad]; [self initSubViews]; [self initSubViewConstraints]; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; [self.presenter getGiveDiamondRecord]; [self.presenter rechargeUserInfo]; } @@ -69,8 +97,10 @@ - (void)initSubViews { self.view.backgroundColor = [UIColor whiteColor]; self.title = YMLocalizedString(@"XPMineGiveDiamondVC0"); - [self.view addSubview: self.infoContainer]; + [self.view addSubview:self.searchView]; + [self.view addSubview:self.infoContainer]; + [self.view addSubview:self.recentTransfersTitleLabel]; [self.view addSubview:self.tableView]; [self.view addSubview:self.tagView]; @@ -81,18 +111,40 @@ [self.infoContainer addSubview:self.idLabel]; [self.infoContainer addSubview:self.starsStack]; [self.infoContainer addSubview:self.helpButton]; + [self.infoContainer addSubview:self.transferCoinsTitleLabel]; + [self.infoContainer addSubview:self.transferCoinsLabel]; + [self.infoContainer addSubview:self.moneyIcon]; + [self.infoContainer addSubview:self.viewDetailButton]; + [self.infoContainer addSubview:self.subRechargeButton]; + [self.infoContainer addSubview:self.subRechargeTitleLabel]; + [self.infoContainer addSubview:self.subRechargeNumLabel]; + + if ([self.userInfo isArabia]) { + [self.infoContainer addSubview:self.ÜSSettlementTitleLabel]; + [self.infoContainer addSubview:self.ÜSSettlementLabel]; + } } - (void)initSubViewConstraints { + + [self.searchView mas_remakeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.view).offset(14); + make.leading.trailing.equalTo(self.view); + make.height.mas_equalTo(kGetScaleWidth(32)); + }]; + [self.infoContainer mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.view); + make.top.equalTo(self.searchView.mas_bottom).offset(14); make.leading.trailing.equalTo(self.view).inset(15); - make.height.mas_equalTo(kGetScaleWidth(81)); + if ([self.userInfo isArabia]) { + make.height.mas_equalTo(kGetScaleWidth(214)); + } else { + make.height.mas_equalTo(kGetScaleWidth(190)); + } }]; [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.centerY.mas_equalTo(self.infoContainer); - make.leading.mas_equalTo(self.infoContainer).offset(12); + make.top.leading.mas_equalTo(self.infoContainer).offset(12); make.width.height.mas_equalTo(kGetScaleWidth(59)); }]; [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { @@ -142,17 +194,100 @@ make.leading.mas_equalTo(self.starsStack.mas_trailing).offset(8); make.size.mas_equalTo(CGSizeMake(22, 22)); }]; + + if ([self.userInfo isArabia]) { + [self.ÜSSettlementTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(11); + make.leading.mas_equalTo(self.avatarImageView); + make.height.mas_equalTo(22); + }]; + + [self.ÜSSettlementLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.transferCoinsTitleLabel.mas_bottom).offset(6); + make.leading.mas_equalTo(self.avatarImageView); + make.height.mas_equalTo(38); + }]; + + [self.transferCoinsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(11); + make.leading.mas_equalTo(self.infoContainer.mas_centerX); + make.height.mas_equalTo(22); + }]; + + [self.transferCoinsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.transferCoinsTitleLabel.mas_bottom).offset(6); + make.leading.mas_equalTo(self.infoContainer.mas_centerX); + make.height.mas_equalTo(38); + }]; + + [self.moneyIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.transferCoinsLabel); + make.leading.mas_equalTo(self.transferCoinsLabel.mas_trailing).offset(4); + make.size.mas_equalTo(CGSizeMake(30, 30)); + }]; + + [self.viewDetailButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.infoContainer).offset(-12); + make.top.mas_equalTo(self.ÜSSettlementLabel.mas_bottom).offset(1); + make.height.mas_equalTo(18); +// make.width.mas_greaterThanOrEqualTo(90); + }]; + } else { + [self.transferCoinsTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(11); + make.leading.mas_equalTo(self.avatarImageView); + make.height.mas_equalTo(22); + }]; + + [self.transferCoinsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.transferCoinsTitleLabel.mas_bottom).offset(6); + make.leading.mas_equalTo(self.avatarImageView); + make.height.mas_equalTo(38); + }]; + + [self.moneyIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.transferCoinsLabel); + make.leading.mas_equalTo(self.transferCoinsLabel.mas_trailing).offset(4); + make.size.mas_equalTo(CGSizeMake(30, 30)); + }]; + + [self.viewDetailButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.infoContainer).offset(-12); + make.centerY.mas_equalTo(self.transferCoinsLabel); + make.height.mas_equalTo(18); + make.width.mas_greaterThanOrEqualTo(90); + }]; + } - [self.searchView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.infoContainer.mas_top);//.offset(14); - make.leading.trailing.equalTo(self.view); - make.height.mas_equalTo(kGetScaleWidth(32)); + [self.subRechargeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(self.infoContainer); + make.height.mas_equalTo(44); }]; + + [self.subRechargeTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.avatarImageView); + make.centerY.mas_equalTo(self.subRechargeButton); + make.height.mas_equalTo(24); + }]; + + [self.subRechargeNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.infoContainer).offset(-12); + make.centerY.mas_equalTo(self.subRechargeButton); + make.height.mas_equalTo(17); + }]; + + [self.recentTransfersTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.infoContainer); + make.height.mas_equalTo(24); + make.top.mas_equalTo(self.infoContainer.mas_bottom).offset(14); + }]; + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.mas_equalTo(self.view); make.bottom.mas_equalTo(-kGetScaleWidth(148)); - make.top.mas_equalTo(self.searchView.mas_bottom).offset(14); + make.top.mas_equalTo(self.recentTransfersTitleLabel.mas_bottom).offset(24); }]; + [self.tagView mas_makeConstraints:^(MASConstraintMaker *make) { make.height.mas_equalTo(kGetScaleWidth(14)); make.centerX.equalTo(self.view); @@ -168,6 +303,16 @@ [TTPopup alertWithConfig:config showBorder:NO confirmHandler:^{} cancelHandler:^{}]; } +- (void)didTapViewDetail { + RechargerTransferHistoryViewController *vc = [[RechargerTransferHistoryViewController alloc] initWithUserInfo:self.userInfo]; + [self.navigationController pushViewController:vc animated:YES]; +} + +- (void)didTapViewSubRecharge { + SubRechargersViewController *vc = [[SubRechargersViewController alloc] init]; + [self.navigationController pushViewController:vc animated:YES]; +} + #pragma mark -XPMineChooseGiveDiamondVCDelegate - (void)xpMineChooseGiveDiamondVCCompleteWithModel:(XPMineGiveDiamondModel *)model{ if(model != nil){ @@ -202,29 +347,39 @@ if(self.datasource.count > 0){ XPMineGiveDiamondCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineGiveDiamondCell class]) forIndexPath:indexPath]; cell.giveDiamondModel = [self.datasource xpSafeObjectAtIndex:indexPath.row]; + @kWeakify(self); + [cell setHandleTapTransfer:^(XPMineGiveDiamondModel * _Nonnull giveDiamondModel) { + @kStrongify(self); + XPMineChooseGiveDiamondVC *vc = [XPMineChooseGiveDiamondVC new]; + vc.giveDiamondModel = giveDiamondModel; + vc.delegate = self; + vc.userInfo = self.userInfo; + [self.navigationController pushViewController:vc animated:YES]; + }]; + [cell setHandleTapHistory:^(XPMineGiveDiamondModel * _Nonnull giveDiamondModel) { + @kStrongify(self); + XPMineGiveDiamondDetailsVC *vc = [[XPMineGiveDiamondDetailsVC alloc]init]; + vc.userInfo = self.userInfo; + XPMineGiveDiamondModel *model = [self.datasource xpSafeObjectAtIndex:indexPath.row]; + vc.toUid = model.targetUid; + [self.navigationController pushViewController:vc animated:YES]; + }]; return cell; + } else { + XPMineFriendEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])forIndexPath:indexPath] ; + cell.emptyTitle = YMLocalizedString(@"XPMineGiveDiamondVC3"); + return cell; } - XPMineFriendEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])forIndexPath:indexPath] ; - - cell.emptyTitle = YMLocalizedString(@"XPMineGiveDiamondVC3"); - return cell; - -} -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ - if(self.datasource.count < indexPath.row)return; - XPMineGiveDiamondDetailsVC *vc = [[XPMineGiveDiamondDetailsVC alloc]init]; - vc.userInfo = self.userInfo; - XPMineGiveDiamondModel *model = [self.datasource xpSafeObjectAtIndex:indexPath.row]; - vc.toUid = model.targetUid; - [self.navigationController pushViewController:vc animated:YES]; } + #pragma mark - XPMineGiveDiamondProtocol -(void)getGiveDiamondListSuccess:(NSArray *)array{ self.datasource = [NSMutableArray arrayWithArray:array]; [self.tableView reloadData]; } + #pragma mark - XPHomeSearchProtocol -(void)searchGivePeopleWihtModel:(XPMineGiveDiamondSearchModel *)model{ [self hideHUD]; @@ -253,23 +408,34 @@ } - (void)loadRechargeUserSuccess:(RechargeUserModel *)userModel { - if (!userModel || userModel.starLevel < 0) { - return; - } self.infoContainer.hidden = NO; - [self.searchView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.infoContainer.mas_bottom).offset(14); - make.leading.trailing.equalTo(self.view); - make.height.mas_equalTo(kGetScaleWidth(32)); - }]; - + self.avatarImageView.imageUrl = userModel.avatar; self.nameLabel.text = userModel.nick; self.icon1ImageView.imageUrl = self.userInfo.userLevelVo.charmUrl; self.icon2ImageView.imageUrl = self.userInfo.userLevelVo.experUrl; self.idLabel.text = [NSString stringWithFormat:@"ID: %@", userModel.erbanNo]; + self.transferCoinsLabel.text = @(userModel.totalGiveGold).stringValue; + + NSTextAttachment *attachMent = [[NSTextAttachment alloc] init]; + attachMent.image = kImage(@"sub_recharger_arrow"); + attachMent.bounds = CGRectMake(0, -4, 17, 17); + NSAttributedString *arrowString = [NSAttributedString attributedStringWithAttachment:attachMent]; + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:@(userModel.subNum).stringValue + attributes:@{ + NSFontAttributeName: self.subRechargeNumLabel.font, + NSForegroundColorAttributeName: self.subRechargeNumLabel.textColor + }]; + [string appendAttributedString:arrowString]; + + self.subRechargeNumLabel.attributedText = string; + + if ([self.userInfo isArabia]) { + self.ÜSSettlementLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_49"), @(userModel.totalGiveGoldUsd)];; + } + if (userModel.starLevel > 0) { [self.star_1 setSelected:YES]; } @@ -296,7 +462,8 @@ _tableView.delegate = self; _tableView.dataSource = self; _tableView.showsVerticalScrollIndicator = NO; - _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.separatorInset = UIEdgeInsetsMake(0, 15, 0, 15); + _tableView.separatorColor = UIColor.lightGrayColor; _tableView.backgroundColor = [UIColor clearColor]; [_tableView registerClass:[XPMineGiveDiamondCell class] forCellReuseIdentifier:NSStringFromClass([XPMineGiveDiamondCell class])]; [_tableView registerClass:[XPMineFriendEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPMineFriendEmptyTableViewCell class])]; @@ -434,4 +601,109 @@ return _helpButton; } +- (UILabel *)transferCoinsTitleLabel { + if (!_transferCoinsTitleLabel) { + _transferCoinsTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_34") + font:kFontMedium(14) + textColor:UIColorFromRGB(0x313131)]; + } + return _transferCoinsTitleLabel; +} + +- (UILabel *)transferCoinsLabel { + if (!_transferCoinsLabel) { + _transferCoinsLabel = [UILabel labelInitWithText:@"18000" + font:kFontSemibold(26) + textColor:UIColorFromRGB(0xFF8C03)]; + } + return _transferCoinsLabel; +} + +- (UIImageView *)moneyIcon { + if (!_moneyIcon) { + _moneyIcon = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + } + return _moneyIcon; +} + +- (UIButton *)viewDetailButton { + if (!_viewDetailButton) { + _viewDetailButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _viewDetailButton.titleLabel.textAlignment = NSTextAlignmentLeft; + NSTextAttachment *attachMent = [[NSTextAttachment alloc] init]; + attachMent.image = kImage(@"sub_recharger_arrow"); + attachMent.bounds = CGRectMake(0, -4, 17, 17); + NSMutableParagraphStyle *style = [[NSMutableParagraphStyle alloc] init]; + style.alignment = NSTextAlignmentLeft; + NSAttributedString *arrowString = [NSAttributedString attributedStringWithAttachment:attachMent]; + NSMutableAttributedString *string = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"1.0.37_text_35") + attributes:@{ + NSFontAttributeName: kFontRegular(12), + NSForegroundColorAttributeName: UIColorFromRGB(0x7b7b7d), + NSParagraphStyleAttributeName: style + }]; + [string appendAttributedString:arrowString]; + [_viewDetailButton setAttributedTitle:string forState:UIControlStateNormal]; + [_viewDetailButton addTarget:self action:@selector(didTapViewDetail) forControlEvents:UIControlEventTouchUpInside]; + [_viewDetailButton.titleLabel sizeToFit]; + } + return _viewDetailButton; +} + +- (UIButton *)subRechargeButton { + if (!_subRechargeButton) { + _subRechargeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_subRechargeButton setBackgroundColor:UIColorFromRGB(0xe7e7e7)]; + [_subRechargeButton addTarget:self action:@selector(didTapViewSubRecharge) forControlEvents:UIControlEventTouchUpInside]; + [_subRechargeButton setCornerRadius:10 + cornerMask:kCALayerMinXMaxYCorner | kCALayerMaxXMaxYCorner]; + } + return _subRechargeButton; +} + +- (UILabel *)subRechargeTitleLabel { + if (!_subRechargeTitleLabel) { + _subRechargeTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_36") + font:kFontMedium(14) + textColor:UIColorFromRGB(0x313131)]; + } + return _subRechargeTitleLabel; +} + +- (UILabel *)subRechargeNumLabel { + if (!_subRechargeNumLabel) { + _subRechargeNumLabel = [UILabel labelInitWithText:@"" + font:kFontRegular(12) + textColor:UIColorFromRGB(0x7b7b7d)]; + } + return _subRechargeNumLabel; +} + +- (UILabel *)ÜSSettlementTitleLabel { + if (!_ÜSSettlementTitleLabel) { + _ÜSSettlementTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_38") + font:kFontMedium(14) + textColor:UIColorFromRGB(0x313131)]; + } + return _ÜSSettlementTitleLabel; +} + +- (UILabel *)ÜSSettlementLabel { + if (!_ÜSSettlementLabel) { + _ÜSSettlementLabel = [UILabel labelInitWithText:@"" + font:kFontSemibold(26) + textColor:UIColorFromRGB(0xFF8C03)]; + } + return _ÜSSettlementLabel; +} + +- (UILabel *)recentTransfersTitleLabel { + if (!_recentTransfersTitleLabel) { + _recentTransfersTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_37") + font:kFontMedium(16) + textColor:UIColorFromRGB(0x161616)]; + } + return _recentTransfersTitleLabel; +} + @end diff --git a/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.h b/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.h new file mode 100644 index 00000000..720e4e6d --- /dev/null +++ b/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.h @@ -0,0 +1,19 @@ +// +// CPEnterRoomTableViewCell.h +// YuMi +// +// Created by P on 2025/2/17. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface CPEnterRoomTableViewCell : UITableViewCell + +@property(nonatomic, assign) NSInteger cpIndex; +@property(nonatomic, copy) NSDictionary *dataSource; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.m b/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.m new file mode 100644 index 00000000..d9070445 --- /dev/null +++ b/YuMi/Modules/YMMine/View/SubViews/CPEnterRoomTableViewCell.m @@ -0,0 +1,101 @@ +// +// CPEnterRoomTableViewCell.m +// YuMi +// +// Created by P on 2025/2/17. +// + +#import "CPEnterRoomTableViewCell.h" + +#import "RoomEnterModel.h" + +@interface CPEnterRoomTableViewCell () + +@property(nonatomic, strong) UIImageView *bgImageView; +@property(nonatomic, strong) UILabel *contentLabel; + +@end + +@implementation CPEnterRoomTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + [self.contentView addSubview:self.bgImageView]; + [self.contentView addSubview:self.contentLabel]; + + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.contentView); + make.height.mas_equalTo(70); + }]; + + [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.leading.mas_equalTo(self.contentView).offset(9); + make.trailing.mas_equalTo(self.contentView).offset(kGetScaleWidth(-66)); + }]; + } + return self; +} + + +- (void)setDataSource:(NSDictionary *)dataSource { + _dataSource = dataSource; + RoomEnterModel *model = [RoomEnterModel modelWithJSON:dataSource]; + + NSString *ar = isMSRTL() ? @"_ar" : @""; + NSString *bgImageKey = [NSString stringWithFormat:@"%@%@",model.screenType == 2 ? @"cp_enter_message" : @"cp_onmic_message", ar]; + self.bgImageView.image = kImage(bgImageKey); + + NSString *name = model.nick; + RoomEnterCPListModel *cpmodel = [model.cpList xpSafeObjectAtIndex:self.cpIndex]; + NSString *cpname = cpmodel.cpNick; + + NSString *cpLevelContentKey = [NSString stringWithFormat:@"RoomEffect_CP_lv_%@", @(cpmodel.cpLevel)]; + NSString *cpLevelContent = YMLocalizedString(cpLevelContentKey); + + NSString *placeHolder = @""; + if (model.screenType == 2) { + placeHolder = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_31"), name, cpLevelContent, cpname]; + } else if (model.screenType == 3) { + placeHolder = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_32"), cpLevelContent, name, cpname]; + } + NSMutableAttributedString *content = [[NSMutableAttributedString alloc] initWithString:placeHolder attributes:@{ + NSFontAttributeName: kFontMedium(13), + NSForegroundColorAttributeName: [UIColor whiteColor] + }]; + NSRange nameRange = [placeHolder rangeOfString:name]; + NSRange cpnameRange = [placeHolder rangeOfString:cpname options:NSBackwardsSearch]; + [content addAttributes:@{ + NSFontAttributeName: kFontMedium(14), + NSForegroundColorAttributeName: UIColorFromRGB(0xffdf66) + } range:nameRange]; + [content addAttributes:@{ + NSFontAttributeName: kFontMedium(14), + NSForegroundColorAttributeName: UIColorFromRGB(0xffdf66) + } range:cpnameRange]; + + self.contentLabel.attributedText = content; +} + + +- (UIImageView *)bgImageView { + if (!_bgImageView) { + _bgImageView = [[UIImageView alloc] init]; + _bgImageView.contentMode = UIViewContentModeScaleAspectFill; + } + return _bgImageView; +} + + +- (UILabel *)contentLabel { + if (!_contentLabel) { + _contentLabel = [UILabel labelInitWithText:@"" font:kFontMedium(13) textColor:[UIColor whiteColor]]; + _contentLabel.numberOfLines = 0; + _contentLabel.adjustsFontSizeToFitWidth = YES; + _contentLabel.minimumScaleFactor = 0.7; + } + return _contentLabel; +} + +@end diff --git a/YuMi/Modules/YMMine/View/XPMineViewController.m b/YuMi/Modules/YMMine/View/XPMineViewController.m index f05d84ae..2d3b89f0 100644 --- a/YuMi/Modules/YMMine/View/XPMineViewController.m +++ b/YuMi/Modules/YMMine/View/XPMineViewController.m @@ -154,7 +154,11 @@ UIKIT_EXTERN NSString *kRequestTicket; #pragma mark- 检查是否有转赠钻石权限 --(void)checkHaveGiveDiamondsPermission{ +-(void)checkHaveGiveDiamondsPermission{ +//#if DEBUG +// self.isHavePermission = YES; +// return; +//#endif ClientConfig *config = [ClientConfig shareConfig]; NSArray *uidList = config.configInfo.giveDiamondErbanNoList; for (id uid in uidList) { @@ -225,8 +229,8 @@ UIKIT_EXTERN NSString *kRequestTicket; [self settingButtonAction]; break; } - case XPMineItemType_Match_Relevance_Account: - [self pushWebViewWithUrl:item.centerUrl]; + case XPMineItemType_Match_Relevance_Account: { + [self pushWebViewWithUrl:item.centerUrl];} break; case XPMineItemType_Foot_Print: { @@ -495,8 +499,7 @@ UIKIT_EXTERN NSString *kRequestTicket; } ///转赠钻石 -(void)pushGiveDiamondVC{ - XPMineGiveDiamondVC *giveDiamondVC = [[XPMineGiveDiamondVC alloc]init]; - giveDiamondVC.userInfo = self.userInfo; + XPMineGiveDiamondVC *giveDiamondVC = [[XPMineGiveDiamondVC alloc] initWithUserModel:self.userInfo]; [self.navigationController pushViewController:giveDiamondVC animated:YES]; } ///点击充值 @@ -670,26 +673,18 @@ UIKIT_EXTERN NSString *kRequestTicket; ///获取VIP信息成功 - (void)getNobleCenterInfoSuccess:(NobleCenterModel *)model { - self.headView.nobleInfo = model; - @kWeakify(self); - [Api vipCenterLevelList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - @kStrongify(self); - if (code == 200){ - NobleCenterModel *model = [NobleCenterModel modelWithDictionary:data.data]; - NobleInfo *vipInfo ; - for (int index = 0; index < model.vipInfos.count; index++) { - NobleInfo *tagInfo = [model.vipInfos xpSafeObjectAtIndex:index]; - if (model.currentLevel > 0){ - if (tagInfo.vipLevel == model.currentLevel) { - vipInfo = tagInfo; - break; - } - } + NobleInfo *vipInfo ; + for (int index = 0; index < model.vipInfos.count; index++) { + NobleInfo *tagInfo = [model.vipInfos xpSafeObjectAtIndex:index]; + if (model.currentLevel > 0){ + if (tagInfo.vipLevel == model.currentLevel) { + vipInfo = tagInfo; + break; } - self.headView.vipInfo = vipInfo; } - [self.tableView reloadData]; - }]; + } + self.headView.nobleInfo = model; + [self.tableView reloadData]; } -(void)getNobleCenterInfoFail{ diff --git a/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m b/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m index a9684c8b..3c928639 100644 --- a/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPHomePagingViewController.m @@ -38,19 +38,6 @@ - (void)viewDidLoad { [super viewDidLoad]; [self setup]; -// [self preLoadGifts]; -} - -/// 禮物面板緩存-1: 登錄後,用空的 roomUid 預加載默認禮物,並緩存 -- (void)preLoadGifts { - [Api requestAllTagsAndNormalGifts:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - if (code == 200 && data.data) { - dispatch_async(dispatch_get_global_queue(0, 0), ^{ - [[XPGiftStorage shareStorage] cacheTagsWith:data.data - inRoom:[[XPGiftStorage shareStorage] defaultKey]]; - }); - } - } roomUid:@""]; } - (void)setup { diff --git a/YuMi/Modules/YMNewHome/View/XPHomePartyViewController.m b/YuMi/Modules/YMNewHome/View/XPHomePartyViewController.m index 4d393b68..c6fc83c0 100644 --- a/YuMi/Modules/YMNewHome/View/XPHomePartyViewController.m +++ b/YuMi/Modules/YMNewHome/View/XPHomePartyViewController.m @@ -221,9 +221,7 @@ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ id item = [self.datasource xpSafeObjectAtIndex:indexPath.row]; - if ([item isKindOfClass:[NSArray class]]) { - - } else { + if ([item isKindOfClass:[HomePlayRoomModel class]]) { HomePlayRoomModel * roomInfo = (HomePlayRoomModel *)item; if (roomInfo.uid.length > 0) { [XPRoomViewController openRoom:roomInfo.uid viewController:self]; diff --git a/YuMi/Modules/YMRTC/RtcManager.m b/YuMi/Modules/YMRTC/RtcManager.m index 83647f08..877126e8 100644 --- a/YuMi/Modules/YMRTC/RtcManager.m +++ b/YuMi/Modules/YMRTC/RtcManager.m @@ -92,10 +92,14 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; } - (void)exitRoom { + @kWeakify(self); [self.engine exitChannel:^{ - [self muteRemote:NO]; - [self muteLocal:NO]; - self.enterdRoomUid = nil; + @kStrongify(self); + if (self) { + [self muteRemote:NO]; + [self muteLocal:NO]; + self.enterdRoomUid = nil; + } }]; } diff --git a/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.h b/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.h new file mode 100644 index 00000000..125cbbc2 --- /dev/null +++ b/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.h @@ -0,0 +1,46 @@ +// +// Api+LuckyPackage.h +// YuMi +// +// Created by P on 2025/2/11. +// + +#import "Api.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Api(LuckyPackage) + +/// {"roomUid":3456, "uid": 3456,"type":"GIFT", "countDownSecond": 300, "giftItems":[{"giftId":12,"giftNum":10},{"giftId":25,"giftNum":10}]} ++ (void)postGiftNewRedEnvelope:(HttpRequestHelperCompletion)complection + countDownSecond:(NSNumber *)countDownSecond + giftItems:(NSArray *)giftItems + roomUid:(NSNumber *)roomUid + uid:(NSString *)uid + type:(NSString *)type; + +/// {"roomUid":3456, "uid": 3456,"num": 10,"goldNum": 1000,"type":"DIAMOND", "countDownSecond": 300} ++ (void)postDiamondNewRedEnvelope:(HttpRequestHelperCompletion)complection + countDownSecond:(NSNumber *)countDownSecond + goldNum:(NSNumber *)goldNum + num:(NSNumber *)num + roomUid:(NSNumber *)roomUid + uid:(NSString *)uid + type:(NSString *)type; + ++ (void)getNewRedEnvelopeList:(HttpRequestHelperCompletion)complection + roomUid:(NSNumber *)roomUid; + ++ (void)getNewRedEnvelopeDetail:(HttpRequestHelperCompletion)complection + pageNo:(NSNumber *)pageNo + pageSize:(NSNumber *)pageSize + type:(NSNumber *)type; + ++ (void)postNewRedEnvelopeOpen:(HttpRequestHelperCompletion)complection redEnvelopeId:(NSNumber *)redEnvelopeId; + ++ (void)getNewRedEnvelopeGet:(HttpRequestHelperCompletion)complection + redEnvelopeId:(NSNumber *)redEnvelopeId; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.m b/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.m new file mode 100644 index 00000000..23c98793 --- /dev/null +++ b/YuMi/Modules/YMRoom/Api/Api+LuckyPackage.m @@ -0,0 +1,70 @@ +// +// Api+LuckyPackage.m +// YuMi +// +// Created by P on 2025/2/11. +// + +#import "Api+LuckyPackage.h" + +@implementation Api(LuckyPackage) + +/// {"roomUid":3456, "uid": 3456,"type":"GIFT", "countDownSecond": 300, "giftItems":[{"giftId":12,"giftNum":10},{"giftId":25,"giftNum":10}]} ++ (void)postGiftNewRedEnvelope:(HttpRequestHelperCompletion)complection + countDownSecond:(NSNumber *)countDownSecond + giftItems:(NSArray *)giftItems + roomUid:(NSNumber *)roomUid + uid:(NSString *)uid + type:(NSString *)type { + NSDictionary *dic = @{ + @"countDownSecond":countDownSecond, + @"giftItems":giftItems, + @"roomUid":roomUid, + @"uid":uid, + @"type":type + }; + [HttpRequestHelper postSkillCard:@"new-red-envelope" params:dic.toJSONString completion:complection]; +} + +/// {"roomUid":3456, "uid": 3456,"num": 10,"goldNum": 1000,"type":"DIAMOND", "countDownSecond": 300} ++ (void)postDiamondNewRedEnvelope:(HttpRequestHelperCompletion)complection + countDownSecond:(NSNumber *)countDownSecond + goldNum:(NSNumber *)goldNum + num:(NSNumber *)num + roomUid:(NSNumber *)roomUid + uid:(NSString *)uid + type:(NSString *)type { + NSDictionary *dic = @{ + @"countDownSecond":countDownSecond, + @"num":num, + @"goldNum":goldNum, + @"roomUid":roomUid, + @"uid":uid, + @"type":type + }; + [HttpRequestHelper postSkillCard:@"new-red-envelope" params:dic.toJSONString completion:complection]; +} + ++ (void)getNewRedEnvelopeList:(HttpRequestHelperCompletion)complection + roomUid:(NSNumber *)roomUid { + [self makeRequest:@"new-red-envelope/list" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, roomUid, nil]; +} + ++ (void)getNewRedEnvelopeDetail:(HttpRequestHelperCompletion)complection + pageNo:(NSNumber *)pageNo + pageSize:(NSNumber *)pageSize + type:(NSNumber *)type { + [self makeRequest:@"new-red-envelope/detail" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, pageNo, pageSize, type, nil]; +} + ++ (void)postNewRedEnvelopeOpen:(HttpRequestHelperCompletion)complection redEnvelopeId:(NSNumber *)redEnvelopeId { + [self makeRequest:@"new-red-envelope/open" method:HttpRequestHelperMethodPOST completion:complection, __FUNCTION__, redEnvelopeId, nil]; +} + + ++ (void)getNewRedEnvelopeGet:(HttpRequestHelperCompletion)complection + redEnvelopeId:(NSNumber *)redEnvelopeId { + [self makeRequest:@"new-red-envelope/get" method:HttpRequestHelperMethodGET completion:complection, __FUNCTION__, redEnvelopeId, nil]; +} + +@end diff --git a/YuMi/Modules/YMRoom/Features/Boom/RoomBoomEntryView.m b/YuMi/Modules/YMRoom/Features/Boom/RoomBoomEntryView.m index 96fb82af..788b3050 100644 --- a/YuMi/Modules/YMRoom/Features/Boom/RoomBoomEntryView.m +++ b/YuMi/Modules/YMRoom/Features/Boom/RoomBoomEntryView.m @@ -60,7 +60,7 @@ [self.progressBG addSubview:self.progress]; [self.progress mas_makeConstraints:^(MASConstraintMaker *make) { make.centerY.mas_equalTo(self.progressBG); - make.leading.mas_equalTo(self.progress).offset(0.5); + make.leading.mas_equalTo(self.progress);//.offset(0.5); make.width.mas_equalTo(0); make.height.mas_equalTo(7); }]; diff --git a/YuMi/Modules/YMRoom/Model/RoomEnterModel.h b/YuMi/Modules/YMRoom/Model/RoomEnterModel.h new file mode 100644 index 00000000..1e5b5f1c --- /dev/null +++ b/YuMi/Modules/YMRoom/Model/RoomEnterModel.h @@ -0,0 +1,46 @@ +// +// RoomEnterModel.h +// YuMi +// +// Created by P on 2025/2/17. +// + +#import "PIBaseModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RoomEnterCPListModel : PIBaseModel + +@property(nonatomic, copy) NSString *cpNick; +@property(nonatomic, copy) NSString *cpAvatar; +@property(nonatomic, assign) NSInteger cpErbanNo; +@property(nonatomic, assign) NSInteger cpLevel; +@property(nonatomic, assign) NSInteger cpUid; + + +@end + +@interface RoomEnterModel : PIBaseModel + +@property(nonatomic, copy) NSString *androidBubbleUrl; +@property(nonatomic, copy) NSString *iosBubbleUrl; +@property(nonatomic, copy) NSString *avatar; +@property(nonatomic, copy) NSString *charmUrl; +@property(nonatomic, assign) NSInteger fromType; +@property(nonatomic, assign) NSInteger defUser; +@property(nonatomic, assign) bool enterHide; +@property(nonatomic, copy) NSString *enterRoomEffects; +@property(nonatomic, assign) NSInteger erbanNo; +@property(nonatomic, assign) NSInteger experLevelSeq; +@property(nonatomic, copy) NSString *experUrl; +@property(nonatomic, assign) bool newUser; +@property(nonatomic, copy) NSString *nick; +@property(nonatomic, assign) NSInteger screenType; //1-普通进房公屏,2-cp进房公屏,3-cp上麦公屏 +@property(nonatomic, assign) NSInteger uid; +@property(nonatomic, copy) NSString *vipIcon; +@property(nonatomic, assign) NSInteger platformRole; // 是否超管 +@property(nonatomic, copy) NSArray *cpList; //进房者的cp列表 + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/Model/RoomEnterModel.m b/YuMi/Modules/YMRoom/Model/RoomEnterModel.m new file mode 100644 index 00000000..7fd26548 --- /dev/null +++ b/YuMi/Modules/YMRoom/Model/RoomEnterModel.m @@ -0,0 +1,22 @@ +// +// RoomEnterModel.m +// YuMi +// +// Created by P on 2025/2/17. +// + +#import "RoomEnterModel.h" + +@implementation RoomEnterCPListModel + +@end + +@implementation RoomEnterModel + ++ (NSDictionary *)objectClassInArray { + return @{ + @"cpList":RoomEnterCPListModel.class + }; +} + +@end diff --git a/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.h b/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.h new file mode 100644 index 00000000..44c669a9 --- /dev/null +++ b/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.h @@ -0,0 +1,157 @@ +// +// RoomLuckyPackageInfoModel.h +// YuMi +// +// Created by P on 2025/2/11. +// + +#import "PIBaseModel.h" +#import "GiftInfoModel.h" +#import "UserInfoModel.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface RedEnvelopeUserVo : PIBaseModel + +@property(nonatomic, assign) NSInteger uid; +@property(nonatomic, assign) NSInteger gender; +@property(nonatomic, assign) NSInteger erbanNo; +@property(nonatomic, assign) NSTimeInterval birth; +@property(nonatomic, copy) NSString *nick; +@property(nonatomic, copy) NSString *avatar; +@end + +@interface RedEnvelopeGiftVo : PIBaseModel + +@property(nonatomic, copy) NSString *giftName; +@property(nonatomic, assign) BOOL isSkipRoom; +@property(nonatomic, assign) NSInteger goldPrice; +@property(nonatomic, assign) NSInteger seqNo; +@property(nonatomic, assign) NSInteger giftId; +@property(nonatomic, copy) NSString *gaaUrl; +@property(nonatomic, copy) NSString *hasSvga; +@property(nonatomic, copy) NSString *giftUrl; +@property(nonatomic, assign) BOOL hasTimeLimit; +@property(nonatomic, assign) BOOL isSendMsg; +@property(nonatomic, assign) BOOL hasLastest; +@property(nonatomic, assign) NSInteger giftType; +@property(nonatomic, assign) BOOL hasVggPic; +@property(nonatomic, assign) BOOL hasEffect; +@property(nonatomic, copy) NSString *luckyGiftSvgaUrl; +@property(nonatomic, assign) BOOL isWholeServer; +@property(nonatomic, copy) NSString *giftExplainUrl; + +@end + + +@interface RedEnvelopeGiftItemVO : PIBaseModel + +@property(nonatomic, assign) NSInteger giftNum; +@property(nonatomic, strong) RedEnvelopeGiftVo *giftVo; +@end + +@interface RedEnvelopeReceiveVo : PIBaseModel + +@property(nonatomic, assign) NSInteger amount; +@property(nonatomic, assign) BOOL isME; +@property(nonatomic, strong) RedEnvelopeUserVo * userVO; +@property(nonatomic, assign) NSTimeInterval createTime; +@property(nonatomic, copy) NSString *createTimeStr; +@property(nonatomic, copy) NSArray *redEnvelopeGiftItemVOs; + +@end + + +@interface RedEnvelopeDetailVo : PIBaseModel + +//{"giftName":"DOdo11","isSkipRoom":false,"goldPrice":10000,"seqNo":-9999999,"giftId":2298,"vggUrl":null,"hasSvga":false,"giftUrl":"https:\/\/image.pekolive.com\/yuand-yingyu.png","hasTimeLimit":false,"isSendMsg":false,"hasLatest":false,"giftType":2,"hasVggPic":true,"hasEffect":false,"luckyGiftSvgaUrl":null,"isWholeServer":false,"giftExplainUrl":"https:\/\/lanhuapp.com\/web\/#\/item\/project\/stage?pid=455641a2-9e80-494a-875d-e209f9e03f70&image_id=6a19205f-c123-48b2-a0df-2c4b0df9bbff"} +@property(nonatomic, copy) NSString *giftName; +@property(nonatomic, assign) BOOL isSkipRoom; +@property(nonatomic, assign) NSInteger goldPrice; +@property(nonatomic, assign) NSInteger seqNo; +@property(nonatomic, assign) NSInteger giftId; +@property(nonatomic, copy) NSString *gaaUrl; +@property(nonatomic, copy) NSString *hasSvga; +@property(nonatomic, copy) NSString *giftUrl; +@property(nonatomic, assign) BOOL hasTimeLimit; +@property(nonatomic, assign) BOOL isSendMsg; +@property(nonatomic, assign) BOOL hasLastest; +@property(nonatomic, assign) NSInteger giftType; +@property(nonatomic, assign) BOOL hasVggPic; +@property(nonatomic, assign) BOOL hasEffect; +@property(nonatomic, copy) NSString *luckyGiftSvgaUrl; +@property(nonatomic, assign) BOOL isWholeServer; +@property(nonatomic, copy) NSStream *giftExplainUrl; + +@end + +@interface RedEnvelopeListVo : PIBaseModel +@property(nonatomic, copy) NSString *avatar; +@property(nonatomic, assign) NSInteger backCommissionAmount; +@property(nonatomic, assign) NSTimeInterval beginTime; +@property(nonatomic, assign) NSInteger commissionAmount; +@property(nonatomic, assign) NSInteger countDownSecond; +@property(nonatomic, assign) NSTimeInterval createTime; +@property(nonatomic, copy) NSString *createTimeStr; +@property(nonatomic, assign) NSTimeInterval endTime; +@property(nonatomic, copy) NSString *giftName; +@property(nonatomic, copy) NSString *id; +@property(nonatomic, assign) NSInteger kind; +@property(nonatomic, copy) NSString *message; +@property(nonatomic, copy) NSString *nick; +@property(nonatomic, assign) NSInteger num; +@property(nonatomic, assign) NSInteger originalAmount; +@property(nonatomic, copy) NSString *position; +@property(nonatomic, assign) NSInteger roomUid; +@property(nonatomic, assign) NSInteger state; +@property(nonatomic, copy) NSString *type; +@property(nonatomic, assign) NSTimeInterval updateTime; +@property(nonatomic, assign) NSInteger userId; +@property(nonatomic, assign) NSInteger validityType; + +@property(nonatomic, assign) BOOL finish; +@property(nonatomic, assign) NSInteger totalNum; +@property(nonatomic, assign) NSInteger redEnvelopeAmount; + +@property(nonatomic, assign) NSInteger redEnvelopeNum; +@property(nonatomic, assign) NSInteger redEnvelopeId; + +@property(nonatomic, copy) NSArray *userVO; + + + +@end + +@interface RedEnvelopeV2Config : PIBaseModel + +@property(nonatomic, assign) bool open; +@property(nonatomic, copy) NSArray *numItems; +@property(nonatomic, copy) NSArray *goldItems; +@property(nonatomic, copy) NSArray *timeItems; +@property(nonatomic, assign) NSInteger expireSeconds; + +@end + +@interface RoomLuckyPackageInfoModel : PIBaseModel + +@property(nonatomic, copy) NSArray * redEnvelopeListVoList; +@property(nonatomic, strong) RedEnvelopeV2Config *redEnvelopeV2Config; + +@end + +@interface OpenRedEnvelopeCurrentUserGift : PIBaseModel + +@property(nonatomic, assign) NSInteger giftNum; +@property(nonatomic, strong) GiftInfoModel *giftVo; + +@end + +@interface OpenRedEnvelopeVo : PIBaseModel + +@property(nonatomic, assign) NSInteger currentUserAmount; +@property(nonatomic, assign) NSInteger redEnvelopeState; // 3:抢光。 4:抢到。 7: 已经抢过 +@property(nonatomic, strong) RedEnvelopeListVo *redEnvelopeVO; +@property(nonatomic, copy) NSArray *currentUserGifts; +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.m b/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.m new file mode 100644 index 00000000..846bcd39 --- /dev/null +++ b/YuMi/Modules/YMRoom/Model/RoomLuckyPackageInfoModel.m @@ -0,0 +1,78 @@ +// +// RoomLuckyPackageInfoModel.m +// YuMi +// +// Created by P on 2025/2/11. +// + +#import "RoomLuckyPackageInfoModel.h" + +@implementation RedEnvelopeUserVo + +@end + +@implementation RedEnvelopeGiftVo + +@end + +@implementation RedEnvelopeGiftItemVO + +@end + +@implementation RedEnvelopeReceiveVo + ++ (NSDictionary *)objectClassInArray { + return @{ + @"redEnvelopeGiftItemVOs":RedEnvelopeGiftItemVO.class + }; +} + +@end + + +@implementation RedEnvelopeDetailVo + +@end + +@implementation RedEnvelopeListVo ++ (NSDictionary *)objectClassInArray { + return @{ + @"userVO":UserInfoModel.class + }; +} + +//+ (NSDictionary *)replacedKeyFromPropertyName { +// return @{ +// @"redEnvelopeId":@"id" +// }; +//} + +@end + +@implementation RedEnvelopeV2Config + + +@end + +@implementation RoomLuckyPackageInfoModel ++ (NSDictionary *)objectClassInArray { + return @{ + @"redEnvelopeListVoList":RedEnvelopeListVo.class + }; +} +@end + +@implementation OpenRedEnvelopeCurrentUserGift + + +@end + +@implementation OpenRedEnvelopeVo + ++ (NSDictionary *)objectClassInArray { + return @{ + @"currentUserGifts":OpenRedEnvelopeCurrentUserGift.class + }; +} + +@end diff --git a/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m b/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m index 5d249cbb..9dc1e882 100644 --- a/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m +++ b/YuMi/Modules/YMRoom/Presenter/XPRoomPresenter.m @@ -107,27 +107,18 @@ [[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) { @kStrongify(self); if (error) { +#ifdef DEBUG + NSLog(@"\n云信进房异常:\n %@", error); +#endif [[self getView] enterRoomFail:error.code]; } else { [[self getView] enterRoomSuccess:chatroom]; } }]; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[userInfo.partitionId]]; - NIMChatroomEnterRequest *publicChatRoomRequest = [[NIMChatroomEnterRequest alloc] init]; - publicChatRoomRequest.roomId = publicChatRoomId; - - NSMutableDictionary *publicChatRoomExt = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:publicChatRoomId]; - publicChatRoomRequest.roomExt = [publicChatRoomExt toJSONString]; - - [[NIMSDK sharedSDK].chatroomManager enterChatroom:publicChatRoomRequest completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) { -// NSLog(@"111"); - }]; } - (void)exitNIMRoom:(NSString *)roomId { [[NIMSDK sharedSDK].chatroomManager exitChatroom:roomId completion:nil]; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[self.infoModel.partitionId]]; - [[NIMSDK sharedSDK].chatroomManager exitChatroom:publicChatRoomId completion:nil]; } /// 开启用户自己的房间 diff --git a/YuMi/Modules/YMRoom/RoomResourceManager.h b/YuMi/Modules/YMRoom/RoomResourceManager.h index 0e4a9928..74673cc0 100644 --- a/YuMi/Modules/YMRoom/RoomResourceManager.h +++ b/YuMi/Modules/YMRoom/RoomResourceManager.h @@ -27,6 +27,8 @@ NS_ASSUME_NONNULL_BEGIN - (UIImage *)loadMicNormalSKinForLock:(BOOL)isLock; - (SVGAVideoEntity *)loadMicEffect; +- (NSString *)loadGiftPanelNum:(NSInteger)pID; + @end diff --git a/YuMi/Modules/YMRoom/RoomResourceManager.m b/YuMi/Modules/YMRoom/RoomResourceManager.m index ab66ba48..39446e92 100644 --- a/YuMi/Modules/YMRoom/RoomResourceManager.m +++ b/YuMi/Modules/YMRoom/RoomResourceManager.m @@ -16,6 +16,7 @@ @property (nonatomic, strong) NSOperationQueue *svgaParseOperationQueue; @property(nonatomic, copy) NSArray *roomMicInfos; +@property(nonatomic, copy) NSDictionary *giftPanelNums; @property(nonatomic, strong) NSMutableDictionary *micSkins; @property(nonatomic, strong) NSMutableDictionary *micBossSkins; @property(nonatomic, strong) NSMutableDictionary *micNormalSkins; @@ -55,7 +56,7 @@ } if ([data isKindOfClass:[NSDictionary class]] ) { NSArray *array = data[@"roomMicDressList"]; - + self.giftPanelNums = data[@"roomGiftPanelNums"]; self.roomMicInfos = [RoomMicInfoModel modelsWithArray:array]; for (RoomMicInfoModel *micInfo in self.roomMicInfos) { switch (micInfo.dressType) { @@ -191,5 +192,9 @@ return [self loadMicSVGAVideo:@(self.currentEffectID).stringValue]; } +- (NSString *)loadGiftPanelNum:(NSInteger)pID { + return [self.giftPanelNums objectForKey:@(pID).stringValue]; +} + @end diff --git a/YuMi/Modules/YMRoom/View/AnimationView/GameUniversalBannerView.m b/YuMi/Modules/YMRoom/View/AnimationView/GameUniversalBannerView.m index a0319e1d..cb9c3c8c 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/GameUniversalBannerView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/GameUniversalBannerView.m @@ -22,6 +22,7 @@ @property (nonatomic, strong) UIButton *goButton; @property (nonatomic, assign) NSString *gameID; @property (nonatomic, strong) SVGAParser *parser; +@property(nonatomic, assign) bool alreadyCancel; @property (nonatomic, copy) void(^completeDisplay)(void); @property (nonatomic, copy) void(^didTapGo)(NSInteger gameID); @@ -50,7 +51,7 @@ @kWeakify(bannerView); [bannerView popEnterAnimation:^(BOOL finished) { - if (finished) { + if (finished && bannerView.alreadyCancel == NO) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ @kStrongify(bannerView); [bannerView popLeaveAnimation:^(bool finished) { @@ -76,6 +77,7 @@ } - (void)dismissBanner { + self.alreadyCancel = YES; [self pop_removeAllAnimations]; // 停止所有动画 [self popLeaveAnimation:^(bool finished) { diff --git a/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m b/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m index 632fcd54..3fbf389c 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/LuckyGiftWinningBannerView.m @@ -142,7 +142,7 @@ exitCurrentRoom:(void(^)(void))exit { - (void)popEnterAnimation:(void(^)(BOOL finished))finish { POPSpringAnimation *enterAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame]; - enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, kGetScaleWidth(kBannerWidth), kGetScaleWidth(kBannerHeight))]; + enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake((KScreenWidth - kGetScaleWidth(kBannerWidth))/2, 0, kGetScaleWidth(kBannerWidth), kGetScaleWidth(kBannerHeight))]; enterAnimation.springBounciness = 10; // 弹性系数 enterAnimation.springSpeed = 12; // 动画速度 enterAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) { diff --git a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.h b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.h index 8de3a63d..9cfc9765 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.h +++ b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.h @@ -19,9 +19,10 @@ NS_ASSUME_NONNULL_BEGIN @interface PIUniversalBannerView : UIView @property (nonatomic,assign) BOOL isSvga; @property (nonatomic,strong) PIUniversalBannerModel *model; - +@property (nonatomic, copy) void(^allowToPlay)(void); @property (nonatomic,weak) id delegate; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m index e71e7a0d..f2cde6b9 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/PIUniversalBannerView.m @@ -15,6 +15,7 @@ @property (strong, nonatomic) SVGAParser *parser; @property (nonatomic,strong) SVGAImageView *svgaView; @property (nonatomic,strong) UIImageView *bgImageView; +@property(nonatomic, strong) NetImageView *imageView; @property (nonatomic,strong) UILabel *titleView; @property (nonatomic,strong) UIButton *clickBtn; @property(nonatomic,strong) SVGAVideoEntity *videoItem; @@ -69,36 +70,71 @@ _model.fontSize = 12; } CGFloat font = _model.fontSize; - NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:font],NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}]; + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:kFontRegular(font), NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:_model.textColor]}]; - for (PIUniversalBannerItemModel *model in _model.contents) { - if([model.type isEqualToString:@"TEXT"]){ - NSDictionary *subTextDic = model.text; - if(subTextDic.allKeys.count > 0){ - NSString *subText = subTextDic[key] == nil ? subTextDic[subTextDic.allKeys.firstObject] : subTextDic[key]; - NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor],NSFontAttributeName:[UIFont systemFontOfSize:font]}]; - if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){ - [attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText]; + dispatch_group_t g = dispatch_group_create(); + @kWeakify(self); + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + for (PIUniversalBannerItemModel *model in self.model.contents) { + if([model.type isEqualToString:@"TEXT"]){ + dispatch_group_enter(g); + NSDictionary *subTextDic = model.text; + if(subTextDic.allKeys.count > 0){ + NSString *subText = subTextDic[key] == nil ? subTextDic[subTextDic.allKeys.firstObject] : subTextDic[key]; + NSAttributedString *attText = [[NSAttributedString alloc]initWithString:subText attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor colorWithHexString:model.textColor],NSFontAttributeName:[UIFont systemFontOfSize:font]}]; + if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){ + [attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attText]; + } + } + dispatch_group_leave(g); + }else if ([model.type isEqualToString:@"IMAGE"]) { + if (![NSString isEmpty:model.key] || + ![NSString isEmpty:model.image]) { + dispatch_group_enter(g); + [[[NSURLSession sharedSession] dataTaskWithURL:[NSURL URLWithString:model.image] completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) { + if (error == nil && data != nil) { + UIImage *image = [UIImage imageWithData:data]; + if (image != nil) { + if ([attribute.string containsString:[NSString stringWithFormat:@"{%@}",model.key]]){ + NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; + + attachment.image = [image setCornerWithRadius:model.height/2 andSize:CGSizeMake(model.width, model.height)]; + attachment.bounds = CGRectMake(0, -model.height/3, model.width, model.height); + NSAttributedString *attImage = [NSAttributedString attributedStringWithAttachment:attachment]; + [attribute replaceCharactersInRange:[attribute.string rangeOfString:[NSString stringWithFormat:@"{%@}",model.key]] withAttributedString:attImage]; + } + } + } + dispatch_group_leave(g); + }] resume]; } } } - } - if(_isSvga == YES){ - self.bgImageView.hidden = YES; - self.svgaView.hidden = NO; - self.titleView.hidden = NO; - self.svgaView.loops = 1; - self.titleView.attributedText = attribute; - self.svgaView.clearsAfterStop = NO; - self.svgaView.videoItem = _model.videoItem; - [self.svgaView startAnimation]; - }else{ - self.bgImageView.hidden = NO; - self.bgImageView.image = _model.image; - self.titleView.hidden = NO; - self.svgaView.hidden = YES; - self.titleView.attributedText = attribute; - } + + dispatch_group_notify(g, dispatch_get_main_queue(), ^{ + @kStrongify(self); + if(self.isSvga == YES){ + self.bgImageView.hidden = YES; + self.svgaView.hidden = NO; + self.titleView.hidden = NO; + self.svgaView.loops = 1; + self.titleView.attributedText = attribute; + self.svgaView.clearsAfterStop = NO; + self.svgaView.videoItem = self.model.videoItem; + [self.svgaView startAnimation]; + }else{ + self.bgImageView.hidden = NO; + self.bgImageView.image = self.model.image; + self.titleView.hidden = NO; + self.svgaView.hidden = YES; + self.titleView.attributedText = attribute; + } + + if (self.allowToPlay) { + self.allowToPlay(); + } + }); + }); } -(void)clickAction{ diff --git a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m index bfb0626c..f843f15b 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m @@ -44,9 +44,12 @@ #import "LuckyGiftWinningFlagView.h" #import "LuckyGiftWinningBannerView.h" #import "RoomHighValueGiftBannerAnimation.h" +#import "LuckyPackageBannerView.h" #import "XCCurrentVCStackManager.h" +#import "RoomEnterModel.h" + // Old Methods #import "DatingInfoModel.h" #import "XPWebViewController.h" @@ -144,10 +147,16 @@ XPRoomGraffitiGiftAnimationViewDelegate @property (nonatomic,strong) SVGAImageView *luckyGiftEffectView; ///福袋礼物送礼物的特效 @property (nonatomic, strong) VAPView *luckyVapGiftEffectView; ///福袋礼物VAP特效 +@property(nonatomic, strong) PIUniversalBannerView *tempUniversalBanner; // 防止内存没有被持有而过早回收 + @end @implementation RoomAnimationView +- (void)setIsPlayOfB:(BOOL)isPlayOfB { + _isPlayOfB = isPlayOfB; +} + - (void)dealloc { [[NIMSDK sharedSDK].broadcastManager removeDelegate:self]; @@ -307,7 +316,8 @@ XPRoomGraffitiGiftAnimationViewDelegate // 开始执行动画 [self playUserEnterRoomAnimation:[dic objectForKey:@"title"] experLevelSeq:[dic objectForKey:@"experLevelSeq"] - effectPath:[dic objectForKey:@"effectPath"]]; + effectPath:[dic objectForKey:@"effectPath"] + isCPEnter:[[dic objectForKey:@"isCP"] boolValue]]; } } @@ -333,7 +343,8 @@ XPRoomGraffitiGiftAnimationViewDelegate - (void)playUserEnterRoomAnimation:(NSString *)title experLevelSeq:(NSString *)experLevelSeq - effectPath:(NSString *)effectPath { + effectPath:(NSString *)effectPath + isCPEnter:(BOOL)isCP { NSDictionary *attributes = @{ NSFontAttributeName:kFontRegular(26), @@ -346,7 +357,9 @@ XPRoomGraffitiGiftAnimationViewDelegate BOOL hasEffectPath = ![NSString isEmpty:effectPath]; [self addEnterEffectView: hasEffectPath]; - if (hasEffectPath) { + if (isCP) { + [self playCPPPPEnterRoomSvgaWith:attributeString]; + } else if (hasEffectPath) { [self playEnterRoomSvga:effectPath content:attributeString needMoveAnimation:YES]; @@ -378,6 +391,7 @@ XPRoomGraffitiGiftAnimationViewDelegate completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { @kStrongify(self); self.enterEffectView.alpha = 1; + self.enterEffectView.hidden = NO; self.enterEffectView.videoItem = videoItem; [self.enterEffectView setAttributedText:content forKey:@"room_text"]; [self.enterEffectView startAnimation]; @@ -403,6 +417,29 @@ XPRoomGraffitiGiftAnimationViewDelegate [self playEnterRoomSvga:targetPath content:content needMoveAnimation:NO]; } +- (void)playCPPPPEnterRoomSvgaWith:(NSAttributedString *)content { + if ([NSString isEmpty:content.string]) { + [self endAnimationEnterEffect]; + return; + } + NSString *path = @"CP进场"; + @kWeakify(self); + SVGAParser *parser = [[SVGAParser alloc] init]; + [parser parseWithNamed:path inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { + @kStrongify(self); + self.enterEffectView.loops = 0; + self.enterEffectView.alpha = 1; + self.enterEffectView.hidden = NO; + self.enterEffectView.videoItem = videoItem; + [self.enterEffectView setAttributedText:content forKey:@"room_text"]; + [self.enterEffectView startAnimation]; + [self popAnimationEnterEffect]; + } failureBlock:^(NSError * _Nonnull error) { + @kStrongify(self); + [self endAnimationEnterEffect]; + }]; +} + - (void)popAnimationEnterEffect { @kWeakify(self); [self enterRoomAnimationFor:self.enterEffectView @@ -433,6 +470,9 @@ XPRoomGraffitiGiftAnimationViewDelegate self.isRoomBannerV2Displaying = NO; return; } + if (self.isRoomBannerV2Displaying) { + return; + } // 从队列中取出第一个元素并移出队列 AttachmentModel *nextAttachment = [self.roomBannertModelsQueueV2 firstObject]; @@ -462,11 +502,42 @@ XPRoomGraffitiGiftAnimationViewDelegate case Custom_Message_Sub_Gift_ChannelNotify: [self playRoomGiftBanner:nextAttachment]; break; + case Custom_Message_Sub_LuckyPackage: + [self playLuckyPackageBanner:nextAttachment]; + break; default: break; } } +- (void)receiveLuckyPackageBanner:(AttachmentModel *)obj { + [self.roomBannertModelsQueueV2 addObject:obj]; + if (!self.isRoomBannerV2Displaying) { + [self processNextRoomEffectAttachment]; + } +} + +- (void)playLuckyPackageBanner:(AttachmentModel *)obj { + if (!obj.data) { + self.isRoomBannerV2Displaying = NO; + [self processNextRoomEffectAttachment]; + return; + } + @kWeakify(self); + RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo; + [LuckyPackageBannerView display:self.bannerContainer + inRoomUid:roomInfo.uid + with:obj + complete:^{ + @kStrongify(self); + self.isRoomBannerV2Displaying = NO; + [self processNextRoomEffectAttachment]; + } exitCurrentRoom:^{ + @kStrongify(self); + [self.hostDelegate exitRoom]; + }]; +} + - (void)receiveRoomGiftBanner:(AttachmentModel *)obj { [self.roomBannertModelsQueueV2 addObject:obj]; if (!self.isRoomBannerV2Displaying) { @@ -476,6 +547,7 @@ XPRoomGraffitiGiftAnimationViewDelegate - (void)playRoomGiftBanner:(AttachmentModel *)obj { if (!obj.data) { + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; return; } @@ -485,6 +557,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:obj complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; }]; } @@ -502,6 +575,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:attachment complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; }]; } @@ -512,6 +586,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:attachMent complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; }]; } @@ -522,6 +597,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:attachMent complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; }]; } @@ -549,6 +625,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:nextAttachment complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; } exitCurrentRoom:^{ @kStrongify(self); @@ -589,6 +666,7 @@ XPRoomGraffitiGiftAnimationViewDelegate with:attachment complete:^{ @kStrongify(self); + self.isRoomBannerV2Displaying = NO; [self processNextRoomEffectAttachment]; } goToGame:^(NSInteger gameID) { @kStrongify(self); @@ -609,7 +687,7 @@ XPRoomGraffitiGiftAnimationViewDelegate } [self.hostDelegate.getSuperView addSubview:vc.view]; vc.view.tag = 913; - return; + break; } } }]; @@ -720,6 +798,9 @@ XPRoomGraffitiGiftAnimationViewDelegate if (giftInfo == nil) { giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId]; } + if (giftInfo == nil) { + giftInfo = [receiveInfo.displayGift xpSafeObjectAtIndex:0]; + } receiveInfo.gift = giftInfo; RoomInfoModel * roomInfo = [self.hostDelegate getRoomInfo]; @@ -858,25 +939,26 @@ XPRoomGraffitiGiftAnimationViewDelegate [self playGiftEffectWithVapUrl:giftInfo.luckyGiftSvgaUrl]; } } else { + [self stopCarEffect:giftInfo.goldPrice]; if (giftInfo.otherViewType == GiftOtherViewTypePag || giftInfo.otherViewType == GiftOtherViewTypeMp4) { - [self stopCarEffect:giftInfo.goldPrice]; - if (giftInfo.otherViewType == GiftOtherViewTypePag) { + if (giftInfo.otherViewType == GiftOtherViewTypePag) { [self playGiftEffectWithPagUrl:giftInfo.viewUrl]; targetURL = giftInfo.viewUrl; - } else { + } else { self.mp4TempReceiveInfoModel = receiveInfo; [self playGiftEffectWithVapUrl:giftInfo.viewUrl]; targetURL = giftInfo.viewUrl; - } - } else if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0) { - [self stopCarEffect:giftInfo.goldPrice]; - [self playGiftEffectWithVggUrl:giftInfo.vggUrl]; - targetURL = giftInfo.vggUrl; - } + } + } + // 兜底,同时判断是否可以执行 svga + if ([NSString isEmpty:targetURL] && giftInfo.hasVggPic && giftInfo.vggUrl.length > 0) { + [self playGiftEffectWithVggUrl:giftInfo.vggUrl]; + targetURL = giftInfo.vggUrl; + } } - NSLog(@"******************* 执行播放 %@ - %@, self.svgaQueue num: %@", @(giftInfo.otherViewType), targetURL, @(self.svgaQueue.count)); + NSLog(@"******************* 执行播放, 是否MP4:%@,URL: %@, self.svgaQueue num: %@", @(giftInfo.otherViewType), targetURL, @(self.svgaQueue.count)); [[NSNotificationCenter defaultCenter] postNotificationName:@"kExchangeRoomAnimationViewAndGameViewIndex" object:nil]; @@ -983,6 +1065,7 @@ XPRoomGraffitiGiftAnimationViewDelegate } - (void)playVGG:(SVGAVideoEntity *)videoItem { + [self.vggGiftEffectView stopAnimation]; [self _addSubviewToMiddleContainer:self.vggGiftEffectView]; [self _updateGiftEffectContentMode:self.vggGiftEffectView size:videoItem.videoSize]; @@ -1182,6 +1265,12 @@ XPRoomGraffitiGiftAnimationViewDelegate AttachmentModel *attachment = (AttachmentModel *)obj.attachment; switch (attachment.first) { + case CustomMessageType_User_Enter_Room: + [self _handleEnterRoomMessage:message]; + break; + case CustomMessageType_RedPacket: + [self _handleLuckyPackageMessage:attachment]; + break; case CustomMessageType_Gift: [self _handleGiftMessage:attachment]; break; @@ -1248,6 +1337,73 @@ XPRoomGraffitiGiftAnimationViewDelegate } } +- (void)_handleEnterRoomMessage:(NIMMessage *)message { + NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; + if (obj.attachment == nil || ![obj.attachment isKindOfClass:[AttachmentModel class]]) { + return; + } + + AttachmentModel *attachment = (AttachmentModel *)obj.attachment; + switch (attachment.second) { + case Custom_Message_Sub_User_Enter_Room: { + RoomEnterModel *model = [RoomEnterModel modelWithJSON:attachment.data]; + if (model.platformRole == 1) { + return; + } + if (model.enterHide) { + //隐身进房 + if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) { + [self createEnterHideAnimation]; + } + } else { + NSString *userName = model.nick; + if (model.cpList.count > 0 && model.screenType < 3) { + for (RoomEnterCPListModel *cp in model.cpList) { + NSString *cpName = cp.cpNick; + NSString *cpLevelTitle = [NSString stringWithFormat:@"RoomEffect_CP_lv_%@", @(cp.cpLevel)]; + NSString *title = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_31"), userName, YMLocalizedString(cpLevelTitle), cpName]; + + NSDictionary * dic= @{@"title":title, + @"experLevelSeq":[NSString stringWithFormat:@"%ld", model.experLevelSeq], + @"effectPath" : @"", + @"isCP":@(YES) + }; + [self.enterRoomAnimationQueue addObject:dic]; + } + } else { + NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomAnimationView0"), userName]; + + NSDictionary * dic= @{@"title":title, + @"experLevelSeq":[NSString stringWithFormat:@"%ld", model.experLevelSeq], + @"effectPath" : model.enterRoomEffects.length ? model.enterRoomEffects : @""}; + [self.enterRoomAnimationQueue addObject:dic]; + } + [self tryDequeueAnimation]; + } + } + break; + + default: + break; + } +} + +- (void)_handleLuckyPackageMessage:(AttachmentModel *)attachment { + if ([self _isInSudGame]) { + return; + } + + switch (attachment.second) { + case Custom_Message_Sub_LuckyPackage: + [self receiveLuckGiftBanner:attachment]; + break; + + default: + return; + break; + } +} + - (void)_handleGiftMessage:(AttachmentModel *)attachment { if ([self _isInSudGame]) { return; @@ -1256,7 +1412,9 @@ XPRoomGraffitiGiftAnimationViewDelegate GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; [receiveInfo giftDataAlignment]; - receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_Gift_LuckySend); + receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_Gift_LuckySend || + attachment.second == Custom_Message_Sub_AllMicroLuckySend || + attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend); receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend); receiveInfo.isComboBatch = (attachment.second == Custom_Message_Sub_AllMicroSend); @@ -1277,9 +1435,30 @@ XPRoomGraffitiGiftAnimationViewDelegate case Custom_Message_Sub_Gift_EmbeddedStyle: [self _handleGiftEmbeddedStyle:receiveInfo attachment:attachment]; break; + case 607: + [self receiveLuckGiftBanner:attachment]; + break; + case Custom_Message_Sub_Gift_LuckySend: + case Custom_Message_Sub_AllMicroLuckySend: + case Custom_Message_Sub_AllBatchMicroLuckySend: + { + [self _handleGift:receiveInfo attachment:attachment]; +// if (receiveInfo.mp4Url.length > 0) { +// [self playLuckyGiftEffectWithVapUrl:receiveInfo.mp4Url]; +// } else { +// NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl; +// NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString]; +// if (luckyGiftSvgaUrl.absoluteString.length > 0) { +// [self play:luckyGiftSvgaUrl]; +// } +// } +// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +// [self receiveGift:receiveInfo]; +// }); + } + break; default: - return; break; } @@ -1293,8 +1472,10 @@ XPRoomGraffitiGiftAnimationViewDelegate // 全服礼物,但由自己发送,不在此逻辑播放 return; } + // 处理从位置 发送者 到 接受者 的礼物移动动画 [self receiveGiftHandleSendGiftAnimationWith:receiveInfo attachment:attachment]; + // 播放礼物动画(svga/mp4)(如果有的话) [self receiveGift:receiveInfo]; } } @@ -1468,6 +1649,7 @@ XPRoomGraffitiGiftAnimationViewDelegate } switch (attachment.second) { case Custom_Message_Sub_Room_Gift_LuckBag_FullScree: + case Custom_Message_Sub_Room_Gift_LuckBag_Server: [self receiveLuckyGiftBigPrize:attachment]; break; @@ -1597,20 +1779,21 @@ XPRoomGraffitiGiftAnimationViewDelegate #pragma mark - RoomGuestDelegate: NIMNotificationMessageDelegate - (void)handleNIMNotificationMessage:(NIMMessage *)message { - NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; - NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; - if (!content) { - return; - } - - switch (content.eventType) { - case NIMChatroomEventTypeEnter: - [self enterRoom:message content:content]; - break; - - default: - break; - } + return; +// NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; +// NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; +// if (!content) { +// return; +// } +// +// switch (content.eventType) { +// case NIMChatroomEventTypeEnter: +// [self enterRoom:message content:content]; +// break; +// +// default: +// break; +// } } #pragma mark - NIMBroadcastManagerDelegate @@ -1851,7 +2034,7 @@ XPRoomGraffitiGiftAnimationViewDelegate if (_enterEffectView == nil) { _enterEffectView = [[SVGAImageView alloc]init]; _enterEffectView.delegate = self; - _enterEffectView.contentMode = UIViewContentModeScaleAspectFit; + _enterEffectView.contentMode = UIViewContentModeScaleAspectFill; _enterEffectView.frame = CGRectMake(0, 0, KScreenWidth, 50); _enterEffectView.backgroundColor = [UIColor clearColor]; _enterEffectView.alpha = 0; @@ -2492,40 +2675,48 @@ XPRoomGraffitiGiftAnimationViewDelegate -(void)showGeneralFloatingScreenView:(PIUniversalBannerView *)bannerView model:(PIUniversalBannerModel *)model{ BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"]; bannerView.isSvga = isSvga; - bannerView.model = model; bannerView.delegate = self; - [self.topContainer addSubview:bannerView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:bannerView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(bannerView.frame.size.width / 2, bannerView.center.y)]; + self.tempUniversalBanner = bannerView; + @kWeakify(bannerView); @kWeakify(self); - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, bannerView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, bannerView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 5; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; + [bannerView setAllowToPlay:^{ + @kStrongify(self); + @kStrongify(bannerView); + [self.topContainer addSubview:bannerView]; + POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; + springAnimation.springSpeed = 12; + springAnimation.springBounciness = 10.f; + springAnimation.fromValue = [NSValue valueWithCGPoint:bannerView.center]; + springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(bannerView.frame.size.width / 2, bannerView.center.y)]; + @kWeakify(self); + [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { + if (finished) { + POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; + moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, bannerView.center.y)]; + moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, bannerView.center.y)]; + moveAnimation.beginTime = CACurrentMediaTime() + 5; + moveAnimation.duration = 0.5; + moveAnimation.repeatCount = 1; + moveAnimation.removedOnCompletion = YES; - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; + [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { + @kStrongify(self); + if (finished) { + [bannerView removeFromSuperview]; + self.isPlayOfB = NO; + if(self.animationListB.count > 0){ + [self.animationListB removeObjectAtIndex:0]; + } + [self playAnimationWithModel]; } - [self playAnimationWithModel]; - } - }]; - [bannerView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } + }]; + [bannerView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; + } + }]; + [bannerView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"]; }]; - [bannerView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"]; + + bannerView.model = model; } - (void)roomDatingPublicResult:(AttachmentModel *)attachment { diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.h b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.h deleted file mode 100644 index 39d031d0..00000000 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// YMRoomAnimationView.h -// YUMI -// -// Created by YUMI on 2021/12/6. -// - -#import -#import "XPRoomAnimationHitView.h" -#import "RoomHostDelegate.h" -#import "RoomGuestDelegate.h" -NS_ASSUME_NONNULL_BEGIN - -@interface XPRoomAnimationView : XPRoomAnimationHitView --(void)resumeTimer; -- (instancetype)initWithDelegate:(id)delegate; - -- (void)receiveLuckGiftWinning:( AttachmentModel * _Nullable )attachment; -- (void)receiveLuckGiftBanner:(AttachmentModel *)attachment ; -@end - -NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m deleted file mode 100644 index 85a38ccd..00000000 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m +++ /dev/null @@ -1,2958 +0,0 @@ -// -// YMRoomAnimationView.m -// YUMI -// -// Created by YUMI on 2021/12/6. -// - -#import "XPRoomAnimationView.h" -///Third -#import -#import -#import -#import -#import "QGVAPConfigModel.h" -#import "UIView+VAP.h" - -#import -#import -///Tool -#import "XPGiftStorage.h" -#import "YUMIMacroUitls.h" -#import "ThemeColor+Room.h" -#import "NetImageView.h" -#import "XPRoomGiftAnimationParser.h" -#import "XCCurrentVCStackManager.h" -#import "AccountInfoStorage.h" -#import "ClientConfig.h" -///Model -#import "MicroQueueModel.h" -#import "MicroStateModel.h" -#import "UserInfoModel.h" -#import "GiftReceiveInfoModel.h" -#import "GiftInfoModel.h" -#import "RoomInfoModel.h" -#import "AttachmentModel.h" -#import "XPGiftBigPrizeModel.h" -#import "XPGiftBannerUserInfoModel.h" -#import "XPMessageRemoteExtModel.h" -#import "DatingInfoModel.h" -#import "AcrossRoomPKPrizeModel.h" -#import "RoomHalfHourRankModel.h" -#import "ClientConfig.h" -#import "ActivityInfoModel.h" -///View - -#import "XPRoomGiftBroadcastView.h" -#import "XPRoomCandyGiftView.h" -#import "XPRoomDatingAnimationView.h" -#import "XPRoomNobleLevelUpView.h" -#import "QGVAPWrapView.h" -#import "XPAcrossRoomPKPrizeView.h" -#import "XPRoomViewController.h" -#import "XPRoomAnchorRankBannerView.h" -#import "XPRoomEnterHideTipView.h" -#import "XPRoomLuckyBigPrizeView.h" -#import "XPRoomGiftCompoundView.h" -#import "XPSailingAnimationView.h" -#import "XPRoomGraffitiGiftAnimationView.h" -#import "XPRoomStarKitchenBannerView.h" -#import "XPWebViewController.h" -#import "PIBaseAnimationViewModel.h" -#import "XPTreasureFairyGiftView.h" -#import "XPRoomTarrowBannerView.h" -#import "PIRoomGiftBroadcastWindow.h" -#import "PIUniversalBannerModel.h" -#import "PIUniversalBannerView.h" - -#import "GiftComboManager.h" -#import "LuckyGiftWinningFlagView.h" - -#import "LuckyGiftWinningBannerView.h" - -#import "CPGiftBanner.h" -#import "CPLevelUpAnimation.h" -#import "CPBindingAnimation.h" - -#import "MSRoomGameWebVC.h" -#import "GameUniversalBannerView.h" -#import "RoomHighValueGiftBannerAnimation.h" - -#import "GiftAnimationManager.h" - -@interface XPRoomAnimationView ()< -SVGAPlayerDelegate, -NIMBroadcastManagerDelegate, -XPRoomGiftBroadcastViewDelegate, -HWDMP4PlayDelegate, -XPRoomLuckyBigPrizeViewDelegate, -XPRoomGraffitiGiftAnimationViewDelegate, -XPRoomStarKitchenBannerViewDelegate, -PAGViewListener, -XPRoomAnchorRankBannerViewDelegate, -PIRoomGiftBroadcastWindowDelegate, -PIUniversalBannerViewDelegate, -GiftAnimationDelegate> - -///展示的不同层级 -///最底层的 -@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView; -///中层的 -@property (nonatomic,strong) XPRoomAnimationHitView * middleLevelView; -///高层的 -@property (nonatomic,strong) XPRoomAnimationHitView * highLevleView; - -///动画管理类 -@property (strong, nonatomic) SVGAParser *parser; -///VAP动画管理 -@property (nonatomic, strong) XPRoomGiftAnimationParser *vapParser; -///送礼物的特效 -@property (nonatomic,strong) SVGAImageView *giftEffectView; -///pag动效 -@property(nonatomic,strong) PAGView *giftPagView; -///VAP特效 -@property (nonatomic, strong) VAPView *vapGiftEffectView; -///福袋礼物送礼物的特效 -@property (nonatomic,strong) SVGAImageView *luckyGiftEffectView; -///福袋礼物VAP特效 -@property (nonatomic, strong) VAPView *luckyVapGiftEffectView; -///代理 -@property (nonatomic,weak) iddelegate; - -///礼物定时器 6s刷新一次 -@property (nonatomic,strong)dispatch_source_t giftEffectTimer; - -#pragma mark - 送礼物的动画的 -@property(nonatomic, strong) GiftAnimationManager *giftAnimationManager; -///大礼物是否正在播放 -@property (nonatomic,assign) BOOL isLargeGiftAnimating; -#pragma mark - 进房座驾动画的 -@property (nonatomic, strong) NSMutableArray *carEffectQueue; -@property (nonatomic,strong) SVGAImageView *carEffectView; -///座驾VAP特效 -@property (nonatomic, strong) VAPView *carVapEffectView; -///座驾pag动效 -@property(nonatomic,strong) PAGView *carPagView; -#pragma mark - 进房动画的 -@property (nonatomic, strong) NSMutableArray *enterEffectQueue; -@property (nonatomic,strong) SVGAImageView *enterEffectView; -#pragma mark - 相亲动画的 -@property (nonatomic, strong) NSMutableArray *datingEffectQueue; -@property (nonatomic,strong) SVGAImageView *datingEffectView; -#pragma mark - 跨房PK -@property (nonatomic, strong) NSMutableArray *acrossRoomPKQueue; -#pragma mark - 航海 -@property (nonatomic, strong) NSMutableArray *sailingQueue; -#pragma mark - 涂鸦礼物 -@property (nonatomic, strong) NSMutableArray *graffitiGiftQueue; -///幸运礼物动画是否在播放 -@property (nonatomic,assign) BOOL isLuckyGiftAnimation; -#pragma mark - 心愿礼物 -@property (nonatomic,strong) SVGAImageView *wishGiftEffectView; - -///礼物飘屏 PresentAchieveAbstractMatrix -@property(nonatomic,strong) NSMutableArray *animationListA; -///玩法飘屏 YUMIPresentBigCaptureMatrix -@property(nonatomic,strong) NSMutableArray *animationListB; -///礼物飘屏正在播放中 -@property(nonatomic,assign) BOOL isPlayOfA; -///玩法飘屏正在播放中 -@property(nonatomic,assign) BOOL isPlayOfB; -///animationListA播放完后,如果有animationListB,那么要在animationListA的位置上播放animationListB,只播放一次 -//@property(nonatomic,assign) BOOL isAnimationListAFinish; -@property(nonatomic,strong) NSMutableArray *svgaQueue; -@property(nonatomic,assign) CGFloat broadCastHieght; - -@property (nonatomic, strong) NetImageView *imageLoader; - -@property (nonatomic, copy) NSString *GiftDynamicEffectListPath; - -/// 新的特效播放队列,包括幸运礼物 banner, CP banner 和 CP 特效 -/// 1.0.28 追加游戏 banner 的处理 -@property (nonatomic, strong) NSMutableArray *roomEffectModelsQueueV2; -@property (nonatomic, assign) BOOL isRoomEffectV2Displaying; - -///CP特效 -@property (nonatomic, strong) AttachmentModel *cpAttachment; - -@property(nonatomic, strong) GiftReceiveInfoModel *mp4TempReceiveInfoModel; -@property(nonatomic, strong) NSMutableArray *avatarLoaders; - -@end - -@implementation XPRoomAnimationView - -- (void)dealloc { - if (self.giftEffectTimer) { - dispatch_source_cancel(self.giftEffectTimer); - self.giftEffectTimer = nil; - } - [NSObject cancelPreviousPerformRequestsWithTarget:self]; - [[NIMSDK sharedSDK].broadcastManager removeDelegate:self]; - -} --(void)resumeTimer{ - if(self.giftEffectTimer != nil){ - dispatch_source_cancel(self.giftEffectTimer); - self.giftEffectTimer = nil; - } - [self.giftPagView removeListener:self]; -} - -- (instancetype)initWithDelegate:(id)delegate { - self = [super init]; - if (self) { - [[NIMSDK sharedSDK].broadcastManager addDelegate:self]; - self.delegate = delegate; - - [self initSubViews]; - [self initSubViewConstraints]; - - self.giftAnimationManager = [[GiftAnimationManager alloc] initWithContainerView:self.lowLevelView]; - self.giftAnimationManager.delegate = self; - - _roomEffectModelsQueueV2 = [NSMutableArray array]; - _GiftDynamicEffectListPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) xpSafeObjectAtIndex:0] stringByAppendingPathComponent:@"GiftDynamicEffectList"]; - - } - return self; -} - -#pragma mark - Private Method -- (void)initSubViews { - [self addSubview:self.lowLevelView]; - [self addSubview:self.middleLevelView]; - [self addSubview:self.highLevleView]; -} - -- (void)initSubViewConstraints { - [self.lowLevelView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.mas_equalTo(self); - }]; - - [self.middleLevelView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.mas_equalTo(self); - }]; - - [self.highLevleView mas_makeConstraints:^(MASConstraintMaker *make) { - make.edges.mas_equalTo(self); - }]; -} - -//自己是否在游戏中 -- (BOOL)isInSudGame { - BOOL isGamePlaying = NO; - if (self.delegate.getRoomInfo.type == RoomType_MiniGame) { - for (int i = -1; i<5; i++) { - NSMutableDictionary * micQueue = self.delegate.getMicroQueue; - MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]]; - if (micSequence == nil || micSequence.userInfo == nil) { - continue; - } - if (micSequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) { - isGamePlaying = YES; - break; - } - } - } - return isGamePlaying; -} -#pragma mark - NIMBroadcastDelegate -// 广播消息 -- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{ - if (broadcastMessage.content) { - NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject]; - AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]]; - NSString *partitionId = [NSString stringWithFormat:@"%@",attachment.data[@"partitionId"]]; - if(![partitionId isEqualToString:self.delegate.getUserInfo.partitionId]){ - return; - } - if (attachment.first == CustomMessageType_Gift && attachment.second == Custom_Message_Sub_Gift_ChannelNotify){///广播 全服礼物飘屏 - /// -// [self receiveBroadcastGift:attachment]; -// [self receiveRoomGiftBanner:attachment]; - } else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Noble_LevelUp_Suspend) {///VIP升级全服飘屏 - [self receiveNobleLevelUp:attachment]; - }else if(attachment.first == CustomMessageType_LuckyBag && attachment.second == Custom_Message_Sub_Room_Gift_LuckBag_FullScree){ - [self receiveLuckyGiftBigPrize:attachment]; - }else if(attachment.first == CustomMessageType_Graffiti_Star_Kitchen && attachment.second == Custom_Message_Sub_Star_Kitchen_FullScreen){ - [self receiveRoomGraffitiStarKitchen:attachment]; - }else if(attachment.first == CustomMessageType_Look_Love && attachment.second == Custom_Message_Sub_Look_Love_InRoom_NeedAllMicSend){ - [self receiveCandyTreeGiftHighLevle:attachment]; - }else if (attachment.first == CustomMessageType_Treasure_Fairy && (attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L4 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L5 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L1 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L2 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L3)) { //夺宝精灵 - [self receiveTreasureFairyGiftHighLevel:attachment]; - }else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){ - [self receiveTarotBanner:attachment]; - }else if (attachment.first == CustomMessageType_Common_H5 &&(attachment.second == Custom_Message_Sub_Common_H5_Novice || attachment.second == Custom_Message_Sub_Common_H5_Advanced)){ - [self receiveCommonH5Banner:attachment]; - }else if (attachment.first == CustomMessageType_General_Floating_Screen && - (attachment.second == Custom_Message_Sub_General_Floating_Screen_One_Room || attachment.second == Custom_Message_Sub_General_Floating_Screen_All_Room)){ -// [self receiveRoomGeneralFloatingScreen:attachment]; - // 新版本不处理 - } - } -} - -#pragma mark - RoomGuestDelegate -- (void)handleNIMCustomMessage:(NIMMessage *)message { - NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; - if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { - AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_Gift) { - GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; - [receiveInfo giftDataAlignment]; - - if (attachment.second == Custom_Message_Sub_Gift_EmbeddedStyle) { - if (receiveInfo.giftVo) { - receiveInfo.gift = receiveInfo.giftVo; - } - - receiveInfo.targetUid = [[attachment.data objectForKey:@"recvUserUid"] stringValue]; - receiveInfo.targetNick = [attachment.data objectForKey:@"recvUserNick"]; - receiveInfo.targetAvatar = [attachment.data objectForKey:@"recvUserAvatar"]; - receiveInfo.avatar = [attachment.data objectForKey:@"sendUserAvatar"]; - receiveInfo.nick = [attachment.data objectForKey:@"sendUserNick"]; - receiveInfo.uid = [[attachment.data objectForKey:@"sendUserUid"] stringValue]; - } else if (attachment.second == Custom_Message_Sub_Gift_Send) { - if (receiveInfo.targetUsers.count == 0) { - GiftReceiveUserInfoModel *model = [[GiftReceiveUserInfoModel alloc] init]; - model.nick = receiveInfo.targetNick; - model.avatar = receiveInfo.targetAvatar; - model.uid = receiveInfo.uid.integerValue; - receiveInfo.targetUsers = @[model]; - } - - if (receiveInfo.targetUids.count == 0) { - receiveInfo.targetUids = @[@(receiveInfo.uid.integerValue)]; - } - } - - receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend; - receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend); - receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend; - - if (receiveInfo.isLuckyBagGift) { - [self receiveGiftHandleSendGiftAnimation:attachment]; - if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;} - if (receiveInfo.mp4Url.length > 0) { - [self playLuckyGiftEffectWithVapUrl:receiveInfo.mp4Url]; - } else { - NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl; - NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString]; - if (luckyGiftSvgaUrl.absoluteString.length > 0) { - [self playLuckyGiftEffect:luckyGiftSvgaUrl]; - } - } - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self receiveGift:receiveInfo]; - }); - } else { - if (receiveInfo.gift.notifyFull == 1 && - attachment.second == Custom_Message_Sub_Gift_Send) { - return; - } - [self receiveGiftHandleSendGiftAnimation:attachment]; - [self receiveGift:receiveInfo]; - } - } else if (attachment.first == CustomMessageType_AllMicroSend) { //发送全麦礼物 或者多人礼物 - GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; - [receiveInfo giftDataAlignment]; - receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend); - receiveInfo.isComboBatch = attachment.second == Custom_Message_Sub_AllMicroSend; - receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend); - - if (receiveInfo.isLuckyBagGift) { - [self receiveGiftHandleSendGiftAnimation:attachment]; - if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;} - if (receiveInfo.mp4Url.length > 0) { - [self playLuckyGiftEffectWithVapUrl:receiveInfo.mp4Url]; - } else { - NSString * svgaString = receiveInfo.luckyGiftSvgaUrl.length > 0 ? receiveInfo.luckyGiftSvgaUrl : receiveInfo.gift.luckyGiftSvgaUrl; - NSURL * luckyGiftSvgaUrl = [NSURL URLWithString:svgaString]; - if (luckyGiftSvgaUrl.absoluteString.length > 0) { - [self playLuckyGiftEffect:luckyGiftSvgaUrl]; - } - } - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self receiveGift:receiveInfo]; - }); - } else { - [self receiveGiftHandleSendGiftAnimation:attachment]; - [self receiveGift:receiveInfo]; - } - } else if (attachment.first == CustomMessageType_LuckyBag ) {//福袋消息厅内展示 - [self receiveLuckyGiftBigPrize:attachment]; - } else if (attachment.first == CustomMessageType_Look_Love && (attachment.second == Custom_Message_Sub_Look_Love_AllRoom_Notify) ) {//寻爱之旅 - [self receiveCandyTreeGiftHighLevle:attachment]; - } else if (attachment.first == CustomMessageType_Car_Notify && attachment.second == Custom_Message_Sub_Car_EnterRoom ) {//座驾进房 - [self receiveDriveCarEnterRoom:attachment]; - } else if(attachment.first == CustomMessageType_RoomPlay_Dating && attachment.second == Custom_Message_Sub_Room_Play_Dating_Public_Result) { - [self roomDatingPublicResult:attachment]; - } else if(attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AcrossRoomPK_Result) { - [self acrossRoomPKBannerAnimation:attachment]; - } else if (attachment.first == CustomMessageType_Anchor_FansTeam && attachment.second == Custom_Message_Sub_FansTeam_Join_Success) {///个播粉丝团 - GiftReceiveInfoModel *receiveInfo = [[GiftReceiveInfoModel alloc] init]; - GiftInfoModel *giftInfo = [GiftInfoModel modelWithJSON:attachment.data[@"giftVo"]]; - receiveInfo.gift = giftInfo; - receiveInfo.giftInfo = giftInfo; - [self receiveFansTeamGiftHandleSendGiftAnimation:attachment]; - [self receiveGift:receiveInfo]; - } else if (attachment.first == CustomMessageType_Across_Room_PK && attachment.second == Custom_Message_Sub_AnchorPK_Result) {//个播PK横幅 - [self acrossRoomPKBannerAnimation:attachment]; - } else if (attachment.first == CustomMessageType_Anchor_Hour_Rank && attachment.second == Custom_Message_Sub_Anchor_Hour_Rank) {///个播小时榜 - [self receiveAnchorHourRank:attachment]; - } else if (attachment.first == CustomMessageType_License_Hour_Rank && attachment.second == Custom_Message_Sub_License_Hour_Rank) {///牌照房小时榜 - [self receiveAnchorHourRank:attachment]; - } else if (attachment.first == CustomMessageType_Gift_Compound && attachment.second == Custom_Message_Sub_Gift_Compound) {///魔法小屋合成礼物 - [self receiveGiftCompound:attachment]; - } else if(attachment.first == CustomMessageType_Room_Sailing && (attachment.second == Custom_Message_Sub_Sailing_AllRoom_Notify || attachment.second == Custom_Message_Sub_Sailing_InRoom_NeedAllMicSend)) { - [self receiveRoomSailing:attachment]; - } else if(attachment.first == CustomMessageType_Graffiti_Gift) {///涂鸦礼物 - [self receiveRoomGraffitiGift:attachment]; - } else if(attachment.first == CustomMessageType_Graffiti_Star_Kitchen){///星级厨房飘屏 - [self receiveRoomGraffitiStarKitchen:attachment]; - }else if (attachment.first == CustomMessageType_Treasure_Fairy && (attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L4 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L1 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L2 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L3)) { //夺宝精灵 - [self receiveTreasureFairyGiftHighLevel:attachment]; - }else if (attachment.first == CustomMessageType_Tarot && (attachment.second == Custom_Message_Sub_Tarot_Advanced || attachment.second == Custom_Message_Sub_Tarot_Intermediate)){ - PIBaseAnimationViewModel *giftNotifyInfo = [PIBaseAnimationViewModel modelWithJSON:attachment.data]; - if(attachment.second == Custom_Message_Sub_Tarot_Intermediate && self.delegate.getRoomInfo.uid != giftNotifyInfo.roomUid.integerValue){ - return; - } - [self receiveTarotBanner:attachment]; - }else if (attachment.first == CustomMessageType_Common_H5 &&(attachment.second == Custom_Message_Sub_Common_H5_Novice || attachment.second == Custom_Message_Sub_Common_H5_Advanced)){ - [self receiveCommonH5Banner:attachment]; - }else if (attachment.first == CustomMessageType_General_Floating_Screen && attachment.second == Custom_Message_Sub_General_Floating_Screen_One_Room){ - [self receiveRoomGeneralFloatingScreen:attachment]; - } else if (attachment.first == CustomMessageType_Super_Gift && - attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins) { - [self receiveLuckGiftWinning:attachment]; - } else if (attachment.first == CustomMessageType_Super_Gift && - attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins_ALL_Room) { - [self receiveLuckGiftBanner:attachment]; - } else if (attachment.first == CustomMessageType_CP) { - [self receiveCPEvent: attachment]; - } - } -} - -- (void)handleNIMNotificationMessage:(NIMMessage *)message { - NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; - NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; - if (content.eventType == NIMChatroomEventTypeEnter) { - NIMMessageChatroomExtension * messageExt = (NIMMessageChatroomExtension *)message.messageExt; - NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from]; - XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithJSON:dic]; - if (extModel.enterHide) {//隐身进房 - if ([message.from isEqualToString:[AccountInfoStorage instance].getUid]) { - [self createEnterHideAnimation:dic]; - } - return; - } - - [self userEnterRoom:content ext:extModel]; - } -} - -#pragma mark - 收到游戏大奖飘屏 -- (void)receiveGameBanner:(AttachmentModel *)attachment { - [self.roomEffectModelsQueueV2 addObject:attachment]; - if (!self.isRoomEffectV2Displaying) { - [self processNextRoomEffectAttachment]; - } -} - -- (void)playGameBanner:(AttachmentModel *)attachment { - @kWeakify(self); - [GameUniversalBannerView display:self with:attachment complete:^{ - @kStrongify(self); - [self processNextRoomEffectAttachment]; - } goToGame:^(NSInteger gameID) { - @kStrongify(self); - NSArray *baishunList = [self.delegate getPlayList]; - for (ActivityInfoModel *model in baishunList) { - if (model.id == gameID) { - if ([self.delegate isKindOfClass:[XPRoomViewController class]]){ - MSRoomGameWebVC *vc = [[MSRoomGameWebVC alloc]initWithDelegate:self.delegate gameModel:model]; - vc.view.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); - XPRoomViewController *roomVC = (XPRoomViewController *)self.delegate; - [roomVC addChildViewController:vc]; - XPRoomAnimationView *animationView; - for (id obj in self.delegate.getSuperView.subviews) { - if ([obj isKindOfClass:[XPRoomAnimationView class]]){ - animationView = obj; - break; - } - } - [self.delegate.getSuperView addSubview:vc.view]; - vc.view.tag = 913; - } - return; - } - } - }]; -} - -#pragma mark - 收到送礼者中奖飘屏 -- (void)receiveLuckGiftWinning:(AttachmentModel *)attachment { - RoomInfoModel *roomInfo = self.delegate.getRoomInfo; - [LuckyGiftWinningFlagView display:self - with:attachment - roomID:roomInfo.roomId - uID:[AccountInfoStorage instance].getUid]; -} - -- (void)receiveLuckGiftBanner:(AttachmentModel *)attachment { - [self.roomEffectModelsQueueV2 addObject:attachment]; - if (!self.isRoomEffectV2Displaying) { - [self processNextRoomEffectAttachment]; - } -} - -- (void)processNextRoomEffectAttachment { - // 检查队列是否有元素 - if (self.roomEffectModelsQueueV2.count == 0) { - // 如果队列为空,停止处理 - self.isRoomEffectV2Displaying = NO; - return; - } - - // 从队列中取出第一个元素并移出队列 - AttachmentModel *nextAttachment = [self.roomEffectModelsQueueV2 firstObject]; - [self.roomEffectModelsQueueV2 removeObjectAtIndex:0]; - - // 设置为正在显示的状态 - self.isRoomEffectV2Displaying = YES; - - switch (nextAttachment.second) { - case Custom_Message_Sub_General_Floating_Screen_One_Room: - case Custom_Message_Sub_General_Floating_Screen_All_Room: - [self playGameBanner:nextAttachment]; - break; - case Custom_Message_Sub_Super_Gift_Winning_Coins_ALL_Room: - [self playLuckyWinningBanner:nextAttachment]; - break; - case Custom_Message_Sub_CP_Gift: - [self playCPGiftBanner:nextAttachment]; - break; - case Custom_Message_Sub_CP_Upgrade: - [self playCPLevelUp:nextAttachment]; - break; - case Custom_Message_Sub_CP_Binding: - [self playCPBinding:nextAttachment]; - break; - case Custom_Message_Sub_Gift_ChannelNotify: - [self playRoomGiftBanner:nextAttachment]; - break; - default: - break; - } -} - -- (void)playLuckyWinningBanner:(AttachmentModel *)nextAttachment { -// [self receiveRoomGeneralFloatingScreen] - RoomInfoModel *roomInfo = self.delegate.getRoomInfo; - // 执行 display 方法 - @kWeakify(self); - [LuckyGiftWinningBannerView display:self - inRoomUid:roomInfo.uid - with:nextAttachment - complete:^{ - @kStrongify(self); - // Display 完成后,继续处理下一个 - [self processNextRoomEffectAttachment]; - } exitCurrentRoom:^{ - @kStrongify(self); - [self.delegate exitRoom]; - }]; -} - -#pragma mark - 收到通用飘屏 --(void)receiveRoomGeneralFloatingScreen:(AttachmentModel *)attachment{ - PIBaseAnimationViewModel *roomGraffiti = [PIBaseAnimationViewModel new]; - roomGraffiti.data = attachment.data; - roomGraffiti.type = GiftBannerType_General_Floating_Screen; - roomGraffiti.first = attachment.first; - roomGraffiti.second = attachment.second; - - PIUniversalBannerModel *model = [PIUniversalBannerModel modelWithDictionary:attachment.data]; - if (model.skipType == 7 && - (attachment.second == Custom_Message_Sub_General_Floating_Screen_One_Room || - attachment.second == Custom_Message_Sub_General_Floating_Screen_All_Room)) { - [self receiveGameBanner:attachment]; - } else { - if(self.animationListB.count == 0 && self.isPlayOfB == NO){ - [self createGeneralFloatingScreenAnimation:roomGraffiti bannerModel:model]; - } - [self.animationListB addObject:roomGraffiti]; - } -} -- (void)createGeneralFloatingScreenAnimation:(PIBaseAnimationViewModel *)attachment bannerModel:(PIUniversalBannerModel *)model { - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - - if (!model) { - model = [PIUniversalBannerModel modelWithDictionary:attachment.data]; - } - - BOOL isSvga = [model.resourceType.uppercaseString isEqualToString:@"SVGA"]; - __block PIUniversalBannerView *bannerView; - @kWeakify(self); - if (isSvga == YES) { - SVGAParser *parser = [SVGAParser new]; - [parser parseWithURL:[NSURL URLWithString:model.resourceContent] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - @kStrongify(self); - model.videoItem = videoItem; - CGFloat height = kGetScaleWidth(60); - if(videoItem.videoSize.width > 0){ - height = KScreenWidth * videoItem.videoSize.height / videoItem.videoSize.width; - } - - bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, height)]; - [self showGeneralFloatingScreenView:bannerView model:model]; - } failureBlock:^(NSError * _Nonnull error) { - @kStrongify(self); - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - }]; - }else{ - if (!_imageLoader) { - _imageLoader = [[NetImageView alloc] init]; - } - [self.imageLoader loadImageWithUrl:model.resourceContent - completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { - @kStrongify(self); - model.image = image; - CGFloat width = image.size.width <= 0 ? kGetScaleWidth(60) : image.size.width; - CGFloat height = image.size.height ; - CGFloat getHeight = KScreenWidth * height / width; - if (getHeight > 100) { - getHeight = 100; - } - bannerView = [[PIUniversalBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, getHeight) ]; - [self showGeneralFloatingScreenView:bannerView model:model]; - - } - fail:^(NSError * _Nonnull error) { - @kStrongify(self); - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - }]; - } -} --(void)showGeneralFloatingScreenView:(PIUniversalBannerView *)bannerView model:(PIUniversalBannerModel *)model{ - BOOL isSvga = [model.resourceType isEqualToString:@"SVGA"]; - bannerView.isSvga = isSvga; - bannerView.model = model; - bannerView.delegate = self; - [self.highLevleView addSubview:bannerView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:bannerView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(bannerView.frame.size.width / 2, bannerView.center.y)]; - @kWeakify(self); - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, bannerView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, bannerView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 5; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [bannerView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - } - }]; - [bannerView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [bannerView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"]; -} -#pragma mark - PIUniversalBannerViewDelegate -- (void)pIUniversalBannerView:(PIUniversalBannerView *)view didClick:(PIUniversalBannerModel *)model{ - if (model.skipType == 2){ - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:model.skipContent viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - }else if (model.skipType == 3){ - XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:nil]; - webVC.isPush = YES; - webVC.url = model.skipContent; - [self.delegate.getCurrentNav pushViewController:webVC animated:YES]; - } - -} -#pragma mark - 收到疯狂动物园飘屏 --(void)receiveRoomGraffitiStarKitchen:(AttachmentModel *)attacment{ - PIBaseAnimationViewModel *roomGraffiti = [PIBaseAnimationViewModel new]; - roomGraffiti.data = attacment.data; - roomGraffiti.type = GiftBannerType_kitchen; - roomGraffiti.first = attacment.first; - roomGraffiti.second = attacment.second; - if(self.animationListB.count == 0 && self.isPlayOfB == NO){ - [self createStarKitchenBannerAnimation:roomGraffiti]; - } - [self.animationListB addObject:roomGraffiti]; -} - -- (void)createStarKitchenBannerAnimation:(PIBaseAnimationViewModel *)attacment{ - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomStarKitchenBannerView *starKitchenView = [[XPRoomStarKitchenBannerView alloc]initWithFrame:CGRectMake(0, top, KScreenWidth, kGetScaleWidth(60))]; - starKitchenView.isSvga = attacment.second == Custom_Message_Sub_Star_Kitchen_FullScreen; - XPRoomStarKitchenModel *starModel = [XPRoomStarKitchenModel modelWithDictionary:attacment.data]; - starKitchenView.delegate = self; - starKitchenView.starModel = starModel; - [self.highLevleView addSubview:starKitchenView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:starKitchenView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(starKitchenView.frame.size.width / 2, starKitchenView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, starKitchenView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, starKitchenView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [starKitchenView removeFromSuperview]; - self.isPlayOfB = NO; - - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - } - }]; - [starKitchenView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [starKitchenView pop_addAnimation:springAnimation forKey:@"starKitchenOutAnimation"]; -} - -#pragma mark - XPRoomStarKitchenBannerViewDelegate -- (void)xPRoomStarKitchenBannerView:(XPRoomStarKitchenBannerView *)view didClick:(XPRoomStarKitchenModel *)starModel{ - if(starModel.skipUrl == nil || starModel.skipUrl.length == 0)return; - XPWebViewController * webVC = [[XPWebViewController alloc] initWithRoomUID:starModel.roomUid]; - webVC.isPush = YES; - webVC.url = starModel.skipUrl; - [self.delegate.getCurrentNav pushViewController:webVC animated:YES]; - -} -#pragma mark - 收到h5通用飘屏 --(void)receiveCommonH5Banner:(AttachmentModel *)attachment{ - if ([self isInSudGame]) {return;} - PIBaseAnimationViewModel *giftNotifyInfo = [PIBaseAnimationViewModel modelWithJSON:attachment.data]; - giftNotifyInfo.type = GiftBannerType_Common_H5; - giftNotifyInfo.second = attachment.second; - if (self.animationListB.count == 0 && self.isPlayOfB == NO) { - [self createCommonH5BannerAnimation:giftNotifyInfo]; - } - [self.animationListB addObject:giftNotifyInfo]; -} -- (void)createCommonH5BannerAnimation:(PIBaseAnimationViewModel *)attatchment { - - CGFloat kscale = (CGFloat)55 / (CGFloat)375; - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomTarrowBannerView *tarrowVeiw = [[XPRoomTarrowBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth , KScreenWidth * kscale)isH5:YES]; - tarrowVeiw.isBig = attatchment.second == Custom_Message_Sub_Common_H5_Advanced; - tarrowVeiw.giftH5Info = attatchment; - [self.middleLevelView addSubview:tarrowVeiw]; - - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:tarrowVeiw.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(tarrowVeiw.frame.size.width / 2, tarrowVeiw.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, tarrowVeiw.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2,tarrowVeiw.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [tarrowVeiw removeFromSuperview]; - self.isPlayOfB = NO; - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - [self playAnimationWithModel]; - } - }]; - [tarrowVeiw pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"]; - - -} -#pragma mark - 收到塔罗飘屏 --(void)receiveTarotBanner:(AttachmentModel *)attachment{ - if ([self isInSudGame]) {return;} - PIBaseAnimationViewModel *giftNotifyInfo = [PIBaseAnimationViewModel modelWithJSON:attachment.data]; - - giftNotifyInfo.type = GiftBannerType_Tarrow; - giftNotifyInfo.second = attachment.second; - if (self.animationListB.count == 0 && self.isPlayOfB == NO) { - [self createTarotBannerAnimation:giftNotifyInfo]; - } - [self.animationListB addObject:giftNotifyInfo]; -} - -- (void)createTarotBannerAnimation:(PIBaseAnimationViewModel *)attatchment { - - CGFloat kscale = (CGFloat)55 / (CGFloat)375; - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomTarrowBannerView *tarrowVeiw = [[XPRoomTarrowBannerView alloc]initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth , KScreenWidth * kscale)isH5:NO]; - tarrowVeiw.isBig = attatchment.second == Custom_Message_Sub_Tarot_Advanced; - tarrowVeiw.giftInfo = attatchment; - [self.middleLevelView addSubview:tarrowVeiw]; - - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:tarrowVeiw.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(tarrowVeiw.frame.size.width / 2, tarrowVeiw.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, tarrowVeiw.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2,tarrowVeiw.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [tarrowVeiw removeFromSuperview]; - self.isPlayOfB = NO; - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - // if(self. isAnimationListAFinish == YES){ - // - // [self playAnimationWithModel]; - // self.isAnimationListAFinish = NO; - // return; - // } - [self playAnimationWithModel]; - } - }]; - [tarrowVeiw pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"]; - - -} -#pragma mark - 夺宝精灵横幅 -- (void)receiveTreasureFairyGiftHighLevel:(AttachmentModel *)attatchment { - if ([self isInSudGame]) {return;} - PIBaseAnimationViewModel *giftModel = [PIBaseAnimationViewModel new]; - giftModel.data = attatchment.data; - giftModel.second = attatchment.second; - giftModel.first = attatchment.first; - giftModel.type = GiftBannerType_Fairy; - if (self.animationListB.count == 0 && self.isPlayOfB == NO) { - [self createTreasureFairyBannerAnimation:giftModel]; - } - [self.animationListB addObject:giftModel]; -} -- (void)createTreasureFairyBannerAnimation:(PIBaseAnimationViewModel *)attatchment { - self.isPlayOfB = YES; - CGFloat kscale = (CGFloat)60 / (CGFloat)375; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPTreasureFairyGiftView *treasureView = [[XPTreasureFairyGiftView alloc] initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth , KScreenWidth * kscale)]; - //最大礼物 - if ((attatchment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L5) || (attatchment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L3)) { - treasureView.isMaxLargeGift = YES; - }else{ - treasureView.isMaxLargeGift = NO; - } - if ((attatchment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L4) || (attatchment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L5)) { - treasureView.isDrawGift = YES; //抽奖 - }else{ - treasureView.isDrawGift = NO; //召唤 - } - treasureView.treasureInfo = attatchment.data; - [self.middleLevelView addSubview:treasureView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:treasureView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(treasureView.frame.size.width / 2, treasureView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, treasureView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, treasureView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [treasureView removeFromSuperview]; - self.isPlayOfB = NO; - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - // if(self. isAnimationListAFinish == YES){ - // - // [self playAnimationWithModel]; - // self.isAnimationListAFinish = NO; - // return; - // } - [self playAnimationWithModel]; - } - }]; - [treasureView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [treasureView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"]; -} -#pragma mark - 涂鸦礼物动画 -- (void)receiveRoomGraffitiGift:(AttachmentModel *)attacment { - if (self.graffitiGiftQueue.count == 0) { - [self startGraffitiGiftAnimation:attacment]; - } - [self.graffitiGiftQueue addObject:attacment]; -} - -- (void)startGraffitiGiftAnimation:(AttachmentModel *)model { - NSDictionary * dic = model.data; - NSNumber * giftId = dic[@"giftId"]; - GiftInfoModel * giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId.stringValue]; - NSArray * array = dic[@"drawFixedArray"]; - if (giftInfo.giftUrl.length > 0 && array.count > 0) { - [[SDWebImageManager sharedManager] loadImageWithURL:[NSURL URLWithString:giftInfo.giftUrl] options:SDWebImageProgressiveLoad progress:nil completed:^(UIImage * _Nullable image, NSData * _Nullable data, NSError * _Nullable error, SDImageCacheType cacheType, BOOL finished, NSURL * _Nullable imageURL) { - if (error == nil && image) { - XPRoomGraffitiGiftAnimationView *graffitiView = [[XPRoomGraffitiGiftAnimationView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - graffitiView.giftImage = image; - graffitiView.delegate = self; - graffitiView.model = model; - graffitiView.pointArray = array; - [graffitiView beginDrawAnimation]; - [self.highLevleView addSubview:graffitiView]; - } else { - [self.graffitiGiftQueue removeObject:model]; - if (self.graffitiGiftQueue.count > 0) { - [self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject]; - } - } - }]; - } else { - [self.graffitiGiftQueue removeObject:model]; - if (self.graffitiGiftQueue.count > 0) { - [self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject]; - } - } -} - - - -- (void)xPRoomGraffitiGiftAnimationViewCompletion:(XPRoomGraffitiGiftAnimationView *)view attachment:(nonnull AttachmentModel *)attachment{ - [view removeFromSuperview]; - if ([self.graffitiGiftQueue containsObject:attachment]) { - [self.graffitiGiftQueue removeObject:attachment]; - } - if (self.graffitiGiftQueue.count > 0) { - [self startGraffitiGiftAnimation:self.graffitiGiftQueue.firstObject]; - } -} - -#pragma mark - 跨房PK横幅动画 -- (void)acrossRoomPKBannerAnimation:(AttachmentModel *)attacment { - AcrossRoomPKPrizeModel * prizeModel = [AcrossRoomPKPrizeModel modelWithJSON:attacment.data]; - if (attacment.second == Custom_Message_Sub_AnchorPK_Result) { - prizeModel.pkType = 1; - } else { - prizeModel.pkType = 0; - } - [self.acrossRoomPKQueue addObject:prizeModel]; - if (self.acrossRoomPKQueue.count == 1 ) {//判断为1个时开始播放,防止多条消息回来后重叠播放 - [self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject]; - } -} - -- (void)startAcrossRoomPKAnimation:(AcrossRoomPKPrizeModel *)model { - XPAcrossRoomPKPrizeView *wishEffectView = [[XPAcrossRoomPKPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight+40, KScreenWidth, 87)]; - wishEffectView.data = model; - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoPkWinRoom:)]; - [wishEffectView addGestureRecognizer:tap]; - [self.highLevleView addSubview:wishEffectView]; - [UIView animateWithDuration:0.5 animations:^{ - wishEffectView.frame = CGRectMake(0, kNavigationHeight+40, KScreenWidth, 87); - } completion:^(BOOL finished) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [UIView animateWithDuration:0.5 animations:^{ - wishEffectView.hidden = YES; - } completion:^(BOOL finished) { - [wishEffectView removeFromSuperview]; - [self.acrossRoomPKQueue removeObject:model]; - if (self.acrossRoomPKQueue.count > 0) { - [self startAcrossRoomPKAnimation:self.acrossRoomPKQueue.firstObject]; - } - }]; - }); - }]; -} - -- (void)gotoPkWinRoom:(UITapGestureRecognizer *)tap { - XPAcrossRoomPKPrizeView * view = (XPAcrossRoomPKPrizeView *)tap.view; - if (view.data.winUid.length > 0) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:view.data.winUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - - } -} - -#pragma mark - 相亲 动画 -- (void)roomDatingPublicResult:(AttachmentModel *)attachment { - self.datingEffectQueue = [NSMutableArray array]; - ///心动结果公布的话 结果是一个数组 - NSArray * results = [DatingInfoModel modelsWithArray:attachment.data[@"list"]]; - [self.datingEffectQueue addObjectsFromArray:results]; - if (self.datingEffectQueue.count > 0) { - [self startDatingAnimation:self.datingEffectQueue.firstObject]; - } -} - -- (void)startDatingAnimation:(DatingInfoModel *)datingModel { - [[NSNotificationCenter defaultCenter] postNotificationName:@"message" object:[self createRoomDatingResultMessage:datingModel]]; - NSString * targetUid= [NSString stringWithFormat:@"%ld", datingModel.targetUid]; - NSString * uid= [NSString stringWithFormat:@"%ld", datingModel.uid]; - if (datingModel.hasHeart || datingModel.hasSelectUser) { - datingModel.originPoint = [self.delegate animationPointAtStageViewByUid:uid]; - datingModel.targetPoint = [self.delegate animationPointAtStageViewByUid:targetUid]; - } - XPRoomDatingAnimationView * datingView = [[XPRoomDatingAnimationView alloc] init]; - [self.highLevleView addSubview:datingView]; - [datingView startAnimationWithModel:datingModel finishBlock:^(BOOL finish) { - [datingView removeFromSuperview]; - [self.datingEffectQueue removeObject:datingModel]; - if (self.datingEffectQueue.count > 0) { - DatingInfoModel * datingModel = [self.datingEffectQueue firstObject]; - [self startDatingAnimation:datingModel]; - } - }]; -} - -- (NIMMessage *)createRoomDatingResultMessage:(DatingInfoModel *)datingModel { - NIMMessage * message = [[NIMMessage alloc] init]; - NIMSession * session = [NIMSession session:[NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId] type:NIMSessionTypeChatroom]; - [message setValue:session forKey:@"session"]; - AttachmentModel * attach = [[AttachmentModel alloc] init]; - attach.first = CustomMessageType_RoomPlay_Dating; - if (datingModel.hasHeart) {///如果是互选的话 - attach.second = Custom_Message_Sub_Room_Play_Dating_Result_Mutual; - } else { - attach.second = Custom_Message_Sub_Room_Play_Dating_Result_Not_Mutual; - } - attach.data = [datingModel model2dictionary]; - NIMCustomObject * object = [[NIMCustomObject alloc] init]; - object.attachment = attach; - message.messageObject = object; - return message; -} - -#pragma mark - 进房动画 XXX来了 -- (void)userEnterRoom:(NIMChatroomNotificationContent *)content ext:(XPMessageRemoteExtModel *)extModel { - 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]) { - userName = extModel.nick; - } else if ([NSString isEmpty:userName]) { - userName = @""; - } - - if(extModel.enterRoomEffects.length > 0){ - NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomAnimationView0"), userName]; - if (self.enterEffectQueue.count ==0) { - [self playUserEnterRoomAnimation:title experLevelSeq:extModel.experLevelSeq effectPath:extModel.enterRoomEffects]; - } - NSDictionary * dic= @{@"title":title, @"experLevelSeq":[NSString stringWithFormat:@"%ld", extModel.experLevelSeq], @"effectPath" : extModel.enterRoomEffects.length ? extModel.enterRoomEffects : @""}; - [self.enterEffectQueue addObject:dic]; - return; - } else if (extModel.experLevelSeq < 30) { - return; - } - - NSString * title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomAnimationView0"), userName]; - if (self.enterEffectQueue.count ==0) { - [self playUserEnterRoomAnimation:title experLevelSeq:extModel.experLevelSeq effectPath:extModel.enterRoomEffects]; - } - NSDictionary * dic= @{@"title":title, @"experLevelSeq":[NSString stringWithFormat:@"%ld", extModel.experLevelSeq], @"effectPath" : extModel.enterRoomEffects.length ? extModel.enterRoomEffects : @""}; - [self.enterEffectQueue addObject:dic]; -} - -- (void)playUserEnterRoomAnimation:(NSString *)title experLevelSeq:(NSInteger)experLevelSeq effectPath:(NSString *)effectPath { - if (self.enterEffectView.superview == nil) { - self.enterEffectView.frame = CGRectMake(KScreenWidth, 339 + kSafeAreaTopHeight, KScreenWidth, effectPath.length ? 75 : 40); - [self.lowLevelView addSubview:self.enterEffectView]; - } - - NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:26], NSForegroundColorAttributeName:[UIColor whiteColor]}]; - [attribute setYy_alignment:NSTextAlignmentLeft]; - - BOOL needRemoveHandly = NO; - - if (effectPath.length > 0) { - needRemoveHandly = YES; - @kWeakify(self); - [self.parser parseWithURL:[NSURL URLWithString:effectPath] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - @kStrongify(self); - self.enterEffectView.loops = 0; - self.enterEffectView.hidden = NO; - self.enterEffectView.clearsAfterStop = YES; - self.enterEffectView.alpha = 1; - self.enterEffectView.videoItem = videoItem; - [self.enterEffectView setAttributedText:attribute forKey:@"room_text"]; - [self.enterEffectView startAnimation]; - } failureBlock:^(NSError * _Nonnull error) { - NSLog(@"%@", error); - }]; - } else { - NSString * path; - if (experLevelSeq >= 30 && experLevelSeq <= 39) { - path = @"experience_entre_effect_30"; - } else if (experLevelSeq >= 40 && experLevelSeq <= 49) { - path = @"experience_entre_effect_40"; - } else if (experLevelSeq >= 50 && experLevelSeq <= 59) { - path = @"experience_entre_effect_50"; - } else if (experLevelSeq >= 60 && experLevelSeq <= 69) { - path = @"experience_entre_effect_60"; - } else if (experLevelSeq >= 70 && experLevelSeq <= 79) { - path = @"experience_entre_effect_70"; - } else if (experLevelSeq >= 80 && experLevelSeq <= 89) { - path = @"experience_entre_effect_80"; - } else if (experLevelSeq > 89) { - path = @"experience_entre_effect_90"; - } - if ([NSString isEmpty:path]) { - return; - } - NSString * anatomiser1Name = [NSString stringWithFormat:@"%@/%@.svga", @"https://image.molistar.xyz/", path]; - @kWeakify(self); - [self.parser parseWithURL:[NSURL URLWithString:anatomiser1Name] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - @kStrongify(self); - self.enterEffectView.loops = 1; - self.enterEffectView.hidden = NO; - self.enterEffectView.clearsAfterStop = NO; - self.enterEffectView.alpha = 1; - self.enterEffectView.videoItem = videoItem; - [self.enterEffectView setAttributedText:attribute forKey:@"room_text"]; - [self.enterEffectView startAnimation]; - } failureBlock:^(NSError * _Nonnull error) { - NSLog(@"%@", error); - }]; - } - - [UIView animateWithDuration:0.5 animations:^{ - self.enterEffectView.frame = CGRectMake(0, 339 + kSafeAreaTopHeight, KScreenWidth, effectPath.length ? 75 : 40); - } completion:^(BOOL finished) { - if (needRemoveHandly) { -// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ -// [self.enterEffectView stopAnimation]; -// }); - [UIView animateWithDuration:0.5 delay:1 options:UIViewAnimationOptionCurveEaseInOut animations:^{ - self.enterEffectView.frame = CGRectMake(-KScreenWidth, 339 + kSafeAreaTopHeight, KScreenWidth, effectPath.length ? 75 : 40); - } completion:^(BOOL finished) { - [self.enterEffectView stopAnimation]; - [self svgaPlayerDidFinishedAnimation:self.enterEffectView]; - }]; - } - }]; -} - -///自己的隐身进房提示 -- (void)createEnterHideAnimation:(NSDictionary *)dic { - XPRoomEnterHideTipView *enterHideTipView = [[XPRoomEnterHideTipView alloc] initWithFrame:CGRectMake(KScreenWidth, (KScreenHeight - 48) * 0.5, KScreenWidth, 48)]; - [self.highLevleView addSubview:enterHideTipView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:enterHideTipView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(enterHideTipView.frame.size.width / 2, enterHideTipView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, enterHideTipView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, enterHideTipView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - [enterHideTipView removeFromSuperview]; - } - }]; - [enterHideTipView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [enterHideTipView pop_addAnimation:springAnimation forKey:@"roomEnterTipUpspingOutAnimation"]; -} - -#pragma mark - 座驾的动画 -- (void)receiveDriveCarEnterRoom:(AttachmentModel *)attatchment { - if (self.isLargeGiftAnimating) {return;} - if ([self isInSudGame]) {return;} - if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;} - NSInteger otherViewType = [attatchment.data[@"otherViewType"] integerValue]; - NSString *viewUrl = attatchment.data[@"viewUrl"]; - NSString * effect = attatchment.data[@"effect"]; - if (viewUrl.length) { - NSDictionary * dic = @{@"otherViewType":@(otherViewType), @"viewUrl":viewUrl}; - if (self.carEffectQueue.count == 0) { - [self playCarEffect:dic]; - } - [self.carEffectQueue addObject:dic]; - } else if(effect.length) { - NSDictionary * dic = @{@"effect":effect}; - if (self.carEffectQueue.count == 0) { - [self playCarEffect:dic]; - } - [self.carEffectQueue addObject:dic]; - } -} - -- (void)playCarEffect:(NSDictionary *)effectDict { - NSString *viewUrl = [effectDict objectForKey:@"viewUrl"]; - NSString *carEffect = [effectDict objectForKey:@"effect"]; - @kWeakify(self); - if (viewUrl.length) { - [self.vapParser parseWithURL:viewUrl completionBlock:^(NSString * _Nullable videoUrl) { - @kStrongify(self); - if (videoUrl.length) { - if([videoUrl containsString:@".pag"]){ - self.carPagView.hidden = NO; - if(self.carPagView.superview == nil){ - [self.middleLevelView addSubview:self.carPagView]; - [self.carPagView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - [self.carPagView setPath:videoUrl]; - self.carPagView.userInteractionEnabled = NO; - self.carPagView.repeatCount = 1; - self.carPagView.scaleMode = PAGScaleModeStretch; - [self.carPagView play]; - } - } else { - self.carVapEffectView.hidden = NO; - if (self.carVapEffectView.superview == nil) { - [self.middleLevelView addSubview:self.carVapEffectView]; - [self.carVapEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - [self.carVapEffectView setMute:NO]; - [self.carVapEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self]; - } - } - } failureBlock:^(NSError * _Nullable error) { - - }]; - } else if (carEffect.length) { - [self.parser parseWithURL:[NSURL URLWithString:carEffect] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { - @kStrongify(self); - if (videoItem != nil) { - if (self.carEffectView.superview == nil) { - [self.middleLevelView addSubview:self.carEffectView]; - [self.carEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - CGFloat width = videoItem.videoSize.width; - CGFloat height = videoItem.videoSize.height; - if (width > height) { - self.carEffectView.contentMode = UIViewContentModeScaleAspectFit; - } else {//高大于宽 - CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度 - if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充 - self.carEffectView.contentMode = UIViewContentModeScaleAspectFill; - } else {//小于屏幕高度, - self.carEffectView.contentMode = UIViewContentModeScaleAspectFit; - } - } - self.carEffectView.hidden = NO; - self.carEffectView.alpha = 1; - self.carEffectView.loops = 1; - self.carEffectView.clearsAfterStop = YES; - self.carEffectView.videoItem = videoItem; - [self.carEffectView startAnimation]; - } - } failureBlock:^(NSError * _Nullable error) { - - }]; - } -} - -#pragma mark - 糖果树横幅动画 -- (void)receiveCandyTreeGiftHighLevle:(AttachmentModel *)attatchment { - if ([self isInSudGame]) {return;} - PIBaseAnimationViewModel *giftModel = [PIBaseAnimationViewModel new]; - giftModel.data = attatchment.data; - giftModel.second = attatchment.second; - giftModel.first = attatchment.first; - giftModel.type = GiftBannerType_Love; - if (self.animationListB.count == 0 && self.isPlayOfB == NO) { - [self createCandyTreeBannerAnimation:giftModel]; - } - [self.animationListB addObject:giftModel]; -} - -- (void)createCandyTreeBannerAnimation:(PIBaseAnimationViewModel *)attatchment { - CGFloat kscale = (CGFloat)60 / (CGFloat)375; - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomCandyGiftView *candyTreeView = [[XPRoomCandyGiftView alloc] initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth , KScreenWidth * kscale)]; - candyTreeView.isMaxLargeGift = attatchment.second == Custom_Message_Sub_Look_Love_InRoom_NeedAllMicSend; - candyTreeView.candyInfo = attatchment.data; - [self.middleLevelView addSubview:candyTreeView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:candyTreeView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(candyTreeView.frame.size.width / 2, candyTreeView.center.y)]; - @kWeakify(self); - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, candyTreeView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, candyTreeView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [candyTreeView removeFromSuperview]; - self.isPlayOfB = NO; - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - // if(self. isAnimationListAFinish == YES){ - // - // [self playAnimationWithModel]; - // self.isAnimationListAFinish = NO; - // return; - // } - [self playAnimationWithModel]; - } - }]; - [candyTreeView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [candyTreeView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"]; -} - -#pragma mark - 航海横幅 -- (void)receiveRoomSailing:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - if (self.sailingQueue.count == 0) { - [self createSailingBannerAnimation:attachment]; - } - [self.sailingQueue addObject:attachment]; -} - -- (void)createSailingBannerAnimation:(AttachmentModel *)attatchment { - CGFloat kscale = (CGFloat)60 / (CGFloat)375; - XPSailingAnimationView *sailingView = [[XPSailingAnimationView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, KScreenWidth * kscale)]; - sailingView.prizeInfo = attatchment.data; - [self.middleLevelView addSubview:sailingView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:sailingView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(sailingView.frame.size.width / 2, sailingView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, sailingView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, sailingView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [sailingView removeFromSuperview]; - if (self.sailingQueue.count > 0) { - [self.sailingQueue removeObjectAtIndex:0]; - } - if (self.sailingQueue.count > 0) { - [self createSailingBannerAnimation:self.sailingQueue.firstObject]; - } - } - }]; - [sailingView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [sailingView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"]; -} - -#pragma mark - VIP升级 -- (void)receiveNobleLevelUp:(AttachmentModel *)attachment { - @kWeakify(self); - [[NetImageView new]loadImageWithUrl:attachment.data[@"avatar"] completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { - @kStrongify(self); - PIBaseAnimationViewModel *nobleModel = [PIBaseAnimationViewModel new]; - nobleModel.data = attachment.data; - nobleModel.type = GiftBannerType_Nobleman; - if (self.animationListB.count == 0 && self.isPlayOfB == NO) { - [self createNobleLevelUpBannerAnimation:nobleModel]; - } - [self.animationListB addObject:nobleModel]; - }]; -} - -- (void)createNobleLevelUpBannerAnimation:(PIBaseAnimationViewModel *)model { - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - - XPRoomNobleLevelUpView *nobleLevelUpView = [[XPRoomNobleLevelUpView alloc] initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, 90)]; - nobleLevelUpView.nobleInfo = model.data; - [self.highLevleView addSubview:nobleLevelUpView]; - @kWeakify(self); - @kWeakify(nobleLevelUpView); - nobleLevelUpView.completionBlock = ^{ - @kStrongify(self); - @kStrongify(nobleLevelUpView); - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:nobleLevelUpView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(nobleLevelUpView.frame.size.width / 2, nobleLevelUpView.center.y)]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, nobleLevelUpView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, nobleLevelUpView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - self.isPlayOfB = NO; - [nobleLevelUpView removeFromSuperview]; - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - // if(self.isAnimationListAFinish == YES){ - // - // [self playAnimationWithModel]; - // self.isAnimationListAFinish = NO; - // return; - // } - [self playAnimationWithModel]; - } - }]; - [nobleLevelUpView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - }); - [nobleLevelUpView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"]; - }; - -} - -#pragma mark - 魔法小屋礼物合成 -- (void)receiveGiftCompound:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - PIBaseAnimationViewModel *magicModel =[PIBaseAnimationViewModel new]; - magicModel.data = attachment.data; - magicModel.type = GiftBannerType_Magic_House; - if(self.animationListB.count == 0 && self.isPlayOfB == NO){ - [self createGiftCompoundBannerAnimation:magicModel]; - } - [self.animationListB addObject:magicModel]; - -} - -- (void)createGiftCompoundBannerAnimation:(PIBaseAnimationViewModel *)attachment { - self.isPlayOfB = YES; - XPRoomGiftCompoundView *compoundGiftView = [[XPRoomGiftCompoundView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)]; - compoundGiftView.compoundGiftInfo = attachment.data; - [self.middleLevelView addSubview:compoundGiftView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:compoundGiftView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(compoundGiftView.frame.size.width / 2, compoundGiftView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, compoundGiftView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, compoundGiftView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [compoundGiftView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - // if(self.isAnimationListAFinish == YES){ - // self.isAnimationListAFinish = NO; - // [self playAnimationWithModel]; - // return; - // } - [self playAnimationWithModel]; - } - }]; - [compoundGiftView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [compoundGiftView pop_addAnimation:springAnimation forKey:@"compoundGiftSpingOutAnimation"]; -} - -#pragma mark - XPRoomAnchorRankBannerViewDelegate -- (void)xPRoomAnchorRankBannerView:(XPRoomAnchorRankBannerView *)view rankInfo:(RoomHalfHourRankModel *)rankInfo{ - if (rankInfo.uid.integerValue > 0 && self.delegate.getRoomInfo.uid != rankInfo.uid.integerValue) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:rankInfo.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } -} -#pragma mark - 个播小时榜飘屏或牌照房小时榜飘屏 -- (void)receiveAnchorHourRank:(AttachmentModel *)attachment { - PIBaseAnimationViewModel *anchorModel =[PIBaseAnimationViewModel new]; - anchorModel.data = attachment.data; - anchorModel.type = GiftBannerType_AnchorHour; - if(self.animationListB.count == 0 && self.isPlayOfB == NO){ - [self createAnchorHourRankAnimation:anchorModel]; - } - [self.animationListB addObject:anchorModel]; -} -- (void)createAnchorHourRankAnimation:(PIBaseAnimationViewModel *)attachment { - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - XPRoomAnchorRankBannerView *anchorRankView = [[XPRoomAnchorRankBannerView alloc] initWithFrame:CGRectMake(KScreenWidth,top, KScreenWidth, kGetScaleWidth(55))]; - anchorRankView.anchorRankInfo = [RoomHalfHourRankModel modelWithDictionary:attachment.data]; - anchorRankView.delegate = self; - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoTopRankAnchorRoom:)]; - [anchorRankView addGestureRecognizer:tap]; - [self.highLevleView addSubview:anchorRankView]; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:anchorRankView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(anchorRankView.frame.size.width / 2, anchorRankView.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, anchorRankView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, anchorRankView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + 3; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - [anchorRankView removeFromSuperview]; - self.isPlayOfB = NO; - if(self.animationListB.count > 0){ - [self.animationListB removeObjectAtIndex:0]; - } - // if(self.isAnimationListAFinish == YES){ - // self.isAnimationListAFinish = NO; - // [self playAnimationWithModel]; - // return; - // } - [self playAnimationWithModel]; - }]; - [anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - } - }]; - [anchorRankView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"]; -} -- (void)gotoTopRankAnchorRoom:(UITapGestureRecognizer *)tap { - XPRoomAnchorRankBannerView * view = (XPRoomAnchorRankBannerView *)tap.view; - if (view.anchorRankInfo.uid.integerValue > 0) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:view.anchorRankInfo.uid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } -} - -#pragma mark - 展示加入粉丝团送礼动画 -- (void)receiveFansTeamGiftHandleSendGiftAnimation:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;} - GiftReceiveInfoModel *receiveInfo = [[GiftReceiveInfoModel alloc] init]; - GiftInfoModel *gift = [GiftInfoModel modelWithJSON:attachment.data[@"giftVo"]]; - receiveInfo.gift = gift; - receiveInfo.giftInfo = gift; - receiveInfo.targetUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid]; - GiftInfoModel * giftInfo = receiveInfo.gift ? receiveInfo.gift : receiveInfo.giftInfo; - if (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend) { - NSString * giftId = [NSString stringWithFormat:@"%ld", receiveInfo.luckyGiftList.giftList.firstObject.giftId]; - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId]; - } - if (giftInfo == nil) { - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId]; - } - - ///在最外面判断是否可以拿到那个礼物 后面使用就不用判断了 - receiveInfo.gift = giftInfo; - receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend); - [self.giftAnimationManager enqueueGift:receiveInfo]; - -} - -#pragma mark - 收到礼物展示动画 -- (void)receiveGiftHandleSendGiftAnimation:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - if (!self.delegate.getRoomInfo.hasAnimationEffect) {return;} - GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; - if (attachment.second == Custom_Message_Sub_Gift_EmbeddedStyle) { - receiveInfo.targetUid = [[attachment.data objectForKey:@"recvUserUid"] stringValue]; - receiveInfo.targetNick = [attachment.data objectForKey:@"recvUserNick"]; - receiveInfo.targetAvatar = [attachment.data objectForKey:@"recvUserAvatar"]; - receiveInfo.avatar = [attachment.data objectForKey:@"sendUserAvatar"]; - receiveInfo.nick = [attachment.data objectForKey:@"sendUserNick"]; - receiveInfo.uid = [[attachment.data objectForKey:@"sendUserUid"] stringValue]; - } - GiftInfoModel * giftInfo = receiveInfo.gift ? receiveInfo.gift : receiveInfo.giftInfo; - if (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend) { - NSString * giftId = [NSString stringWithFormat:@"%ld", receiveInfo.luckyGiftList.giftList.firstObject.giftId]; - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftId]; - } - if (giftInfo == nil) { - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:receiveInfo.giftId]; - } - - ///在最外面判断是否可以拿到那个礼物 后面使用就不用判断了 - receiveInfo.gift = giftInfo; - receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend || attachment.second == Custom_Message_Sub_Gift_LuckySend); - [self.giftAnimationManager enqueueGift:receiveInfo]; - -} - -#pragma mark - GiftAnimationManagerDelegate -- (CGPoint)animationPointAtStageViewByUid:(NSString *)uid { - return [self.delegate animationPointAtStageViewByUid:uid]; -} - -#pragma mark - 全服礼物 飘屏 -- (void)createGiftBroadcastViewAnimation:(GiftReceiveInfoModel *)giftModel { - self.isPlayOfA = YES; - XPRoomGiftBroadcastView * view = [[XPRoomGiftBroadcastView alloc] init]; - view.delegate = self; - view.frame = CGRectMake(KScreenWidth, 35 + statusbarHeight, KScreenWidth, kGetScaleWidth(69)); - view.broadcastModel = giftModel; - [self.highLevleView addSubview:view]; - [self beginGiftBraodcastViewAnimation:view notifyStaySecond:giftModel.notifyStaySecond]; -} - -- (void)beginGiftBraodcastViewAnimation:(XPRoomGiftBroadcastView *)view notifyStaySecond:(int)notifyStaySecond{ - CGFloat startTime = notifyStaySecond > 0 ? notifyStaySecond : 3.0; - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:view.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(0 + view.frame.size.width / 2, view.center.y)]; - [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - if (finished) { - [self removeGiftBroadcastOutAnimation:view stayTime:startTime]; - } - }]; - [view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"]; -} - -- (void)removeGiftBroadcastOutAnimation:(XPRoomGiftBroadcastView *)view stayTime:(CGFloat)stayTime{ - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:view.center]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, view.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime() + stayTime; - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [view removeFromSuperview]; - self.isPlayOfA = NO; - if (self.animationListA.count > 0) { - [self.animationListA removeObjectAtIndex:0]; - } - if (self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) { - [self createGiftBroadcastViewAnimation:self.animationListA.firstObject]; - } - } - }]; - - [view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; -} - -#pragma mark - XPRoomGiftBroadcastViewDelegate -- (void)xPRoomGiftBroadcastView:(XPRoomGiftBroadcastView *)view enterRoom:(NSString *)roomUid roomName:(NSString *)roomName{ - id isShowBroadcastView = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveBrooadcastSelectState"]; - if(isShowBroadcastView == nil){ - PIRoomGiftBroadcastWindow *broadcastView = [[PIRoomGiftBroadcastWindow alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - broadcastView.roodUid = roomUid; - broadcastView.roomName = roomName; - broadcastView.delegate = self; - [kWindow addSubview:broadcastView]; - return; - } - - if (roomUid.length > 0 && self.delegate.getRoomInfo.uid != roomUid.integerValue) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } -} - -#pragma mark - PIRoomGiftBroadcastWindowDelegate --(void)confirmLeaveForTheRoom:(NSString *_Nonnull)roomUid{ - if (roomUid.length > 0 && self.delegate.getRoomInfo.uid != roomUid.integerValue) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.7 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } -} -#pragma mark - 福袋中 四级奖品 -- (void)receiveLuckyGiftBigPrize:(AttachmentModel *)attachment { - if ([self isInSudGame]) {return;} - - PIBaseAnimationViewModel * prizeModel = [PIBaseAnimationViewModel modelWithDictionary:attachment.data]; - prizeModel.type = GiftBannerType_Lucky; - prizeModel.isInRoomVisable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag; - - if(self.animationListB.count == 0 && self.isPlayOfB == NO){ - [self createBigPrizeAnimation:prizeModel]; - } - [self.animationListB addObject:prizeModel]; -} - -- (void)createBigPrizeAnimation:(PIBaseAnimationViewModel *)prizeModel { - - self.isPlayOfB = YES; - CGFloat top = self.isPlayOfA == YES ? (self.broadCastHieght + statusbarHeight) : (kNavigationHeight + 15); - - - self.isLuckyGiftAnimation = YES; - XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 71)]; - luckyGiftEffectView.delegate = self; - [self.highLevleView addSubview:luckyGiftEffectView]; - luckyGiftEffectView.giftInfo = prizeModel; - - POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter]; - springAnimation.springSpeed = 12; - springAnimation.springBounciness = 10.f; - springAnimation.fromValue = [NSValue valueWithCGPoint:luckyGiftEffectView.center]; - springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 7 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter]; - moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, luckyGiftEffectView.center.y)]; - moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, luckyGiftEffectView.center.y)]; - moveAnimation.beginTime = CACurrentMediaTime(); - moveAnimation.duration = 0.5; - moveAnimation.repeatCount = 1; - moveAnimation.removedOnCompletion = YES; - @kWeakify(self); - [moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) { - @kStrongify(self); - if (finished) { - [luckyGiftEffectView removeFromSuperview]; - - if (self.animationListB.count > 0) { - [self.animationListB removeObjectAtIndex:0]; - } - self.isPlayOfB = NO; - [self playAnimationWithModel]; - } - }]; - [luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"]; - - - }); - [luckyGiftEffectView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"]; -} --(void)playAnimationACompletion{ - PIBaseAnimationViewModel *model = self.animationListB.firstObject; - if(model.type == GiftBannerType_Lucky){ - [self createBigPrizeAnimation:model]; - }else if (model.type == GiftBannerType_Love){ - [self createCandyTreeBannerAnimation:model]; - }else if(model.type == GiftBannerType_Nobleman){ - [self createNobleLevelUpBannerAnimation:model]; - }else if(model.type == GiftBannerType_kitchen){ - [self createStarKitchenBannerAnimation:model]; - }else if(model.type == GiftBannerType_AnchorHour){ - [self createAnchorHourRankAnimation:model]; - }else if(model.type == GiftBannerType_LicneseHour){ - [self createAnchorHourRankAnimation:model]; - }else if(model.type == GiftBannerType_Fairy){ - [self createTreasureFairyBannerAnimation:model]; - }else if(model.type == GiftBannerType_Tarrow){ - [self createTarotBannerAnimation:model]; - }else if(model.type == GiftBannerType_Common_H5){ - [self createCommonH5BannerAnimation:model]; - }else if(model.type == GiftBannerType_Magic_House){ - [self createGiftCompoundBannerAnimation:model]; - } -} - --(void)playAnimationWithModel{ - // if(self.isAnimationListAFinish == YES)return; - if(self.animationListB.count <= 0){ - if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){ - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [self createGiftBannerViewAnimation:self.animationListA.firstObject]; - }); - } - return; - } - - if(self.isPlayOfB == YES)return; - - PIBaseAnimationViewModel *model = self.animationListB.firstObject; - if(model.type == GiftBannerType_Lucky){ - [self createBigPrizeAnimation:model]; - }else if (model.type == GiftBannerType_Love){ - [self createCandyTreeBannerAnimation:model]; - }else if(model.type == GiftBannerType_Nobleman){ - [self createNobleLevelUpBannerAnimation:model]; - }else if(model.type == GiftBannerType_kitchen){ - [self createStarKitchenBannerAnimation:model]; - }else if(model.type == GiftBannerType_AnchorHour){ - [self createAnchorHourRankAnimation:model]; - }else if(model.type == GiftBannerType_LicneseHour){ - [self createAnchorHourRankAnimation:model]; - }else if(model.type == GiftBannerType_Fairy){ - [self createTreasureFairyBannerAnimation:model]; - }else if(model.type == GiftBannerType_Tarrow){ - [self createTarotBannerAnimation:model]; - }else if(model.type == GiftBannerType_Common_H5){ - [self createCommonH5BannerAnimation:model]; - }else if(model.type == GiftBannerType_Magic_House){ - [self createGiftCompoundBannerAnimation:model]; - }else if (model.type == GiftBannerType_General_Floating_Screen){ - [self createGeneralFloatingScreenAnimation:model bannerModel:nil]; - } -} - - -#pragma mark - XPRoomLuckyBigPrizeViewDelegate -- (void)xPRoomLuckyBigPrizeView:(XPRoomLuckyBigPrizeView *)view luckyGiftInfo:(PIBaseAnimationViewModel *)giftInfo { - id isShowBroadcastView = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveLuckSelectState"]; - if(isShowBroadcastView == nil){ - PIRoomGiftBroadcastWindow *broadcastView = [[PIRoomGiftBroadcastWindow alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - broadcastView.isLuck = YES; - broadcastView.roodUid = giftInfo.roomUid; - broadcastView.roomName = giftInfo.roomTitle; - broadcastView.delegate = self; - [kWindow addSubview:broadcastView]; - return; - } - if (!giftInfo.isInRoomVisable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) { - [self.delegate exitRoom]; - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - [XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; - }); - } -} - -#pragma mark - 连击效果 -- (void)receiveCombo:(GiftReceiveInfoModel *)receiveInfo { - [[GiftComboManager sharedManager] receiveGiftInfoForDisplayComboFlags:receiveInfo - container:self]; -} - -- (void)startAnimation:(UIView *)animatedView { - // 计算屏幕左边的目标位置 - CGFloat leftPosition = -animatedView.frame.size.width; - - // 动画步骤1:从屏幕右边移入屏幕中间 - [UIView animateWithDuration:0.25 - delay:0 - options:UIViewAnimationOptionCurveEaseInOut - animations:^{ - // 将视图移动到屏幕的中间左侧位置 - animatedView.center = CGPointMake(self.bounds.size.width / 2, self.bounds.size.height / 2); - } completion:^(BOOL finished) { - // 停顿 2 秒后,继续动画移出屏幕左侧 - [self continueAnimationToLeft:leftPosition view:animatedView]; - }]; -} - -// 动画步骤2:移出到屏幕左边 -- (void)continueAnimationToLeft:(CGFloat)leftPosition view:(UIView *)animatedView { - // 停顿 2 秒后开始动画 - [UIView animateWithDuration:0.25 - delay:500.0 - options:UIViewAnimationOptionCurveEaseInOut - animations:^{ - // 将视图移出屏幕左侧 - animatedView.center = CGPointMake(leftPosition, self.bounds.size.height / 2); - } completion:^(BOOL finished) { - // 移除视图,释放内存 - [animatedView removeFromSuperview]; - }]; -} - -#pragma mark - 普通礼物 -///收到了礼物 -- (void)receiveGift:(GiftReceiveInfoModel *)receiveInfo { - if ([self isInSudGame] || receiveInfo.isHomeShow == YES) { - return; - } - - [self receiveCombo:receiveInfo]; - - ///CPU警告的时候 需要停止接收动画 - RoomInfoModel * roomInfo = [self.delegate getRoomInfo]; - if (receiveInfo.isLuckyBagGift) { - if (receiveInfo.isShowAnimation) { - //如果是福袋礼物的话 就不用看他的价值了 只要有SVGA的话 就播放 - if (receiveInfo.displayGift.count > 0) { - [receiveInfo.displayGift enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if ((obj.otherViewType == GiftOtherViewTypeMp4 || obj.otherViewType == GiftOtherViewTypePag) && obj.viewUrl && obj.viewUrl.length > 0 && roomInfo.hasAnimationEffect) { - GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init]; - model.mp4Url = obj.viewUrl; - model.avatar = receiveInfo.sendUserAvatar; - model.gift = obj; - model.giftNum = [obj.giftNum integerValue];; - model.nick = receiveInfo.nick; - model.targetUids = receiveInfo.targetUids; - model.isBatch = receiveInfo.isBatch; - model.targetAvatar = receiveInfo.targetAvatar; - model.targetNick = receiveInfo.targetNick; - [self.svgaQueue addObject:model]; - } else if (obj.hasVggPic && roomInfo.hasAnimationEffect) { - GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init]; - model.mp4Url = obj.viewUrl; - model.avatar = receiveInfo.sendUserAvatar; - model.gift = obj; - model.giftNum = [obj.giftNum integerValue];; - model.nick = receiveInfo.nick; - model.targetUids = receiveInfo.targetUids; - model.isBatch = receiveInfo.isBatch; - model.targetAvatar = receiveInfo.targetAvatar; - model.targetNick = receiveInfo.targetNick; - [self.svgaQueue addObject:model]; - } - }]; - } - } - } else { - GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo; - if (!giftInfo) { - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId]; - } - ///重新赋值一下 用的时候不用在查找了 真的没有的话 那就没有那个礼物了 - if (giftInfo) { - receiveInfo.gift = giftInfo; - } - if (receiveInfo.targetUsers.count > 0 && receiveInfo.targetUids.count <= 0) { - receiveInfo.targetUids = [receiveInfo.targetUsers valueForKeyPath:@"uid"]; - } - - NSInteger giftTotal = 0; - if (receiveInfo.targetUids.count > 0) { - giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count; - } else { - giftTotal = receiveInfo.giftNum * giftInfo.goldPrice; - } - - if ((giftInfo.otherViewType == GiftOtherViewTypeMp4 || - giftInfo.otherViewType == GiftOtherViewTypePag) && - giftInfo.viewUrl.length > 0 && roomInfo.hasAnimationEffect) { - receiveInfo.mp4Url = giftInfo.viewUrl; - // [self.animationListA addObject:receiveInfo]; - [self.svgaQueue addObject:receiveInfo]; - } else if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && roomInfo.hasAnimationEffect) {///SVGA动画 - receiveInfo.vggUrl = giftInfo.vggUrl; - // [self.animationListA addObject:receiveInfo]; - [self.svgaQueue addObject:receiveInfo]; - } - } - if (self.giftEffectTimer == nil && self.svgaQueue.count > 0) { - [self startHandleGiftEffectTimer]; - } -} -///开启普通礼物特效定时器 -- (void)startHandleGiftEffectTimer { - NSTimeInterval period = 1.0; //设置时间间隔 6秒是 1、单纯的svga 2.有横幅有svga 3、只有横幅 - dispatch_queue_t queue = dispatch_get_global_queue(0, 0); - dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); - dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), period * NSEC_PER_SEC, 0); //每秒执行 - @kWeakify(self); - dispatch_source_set_event_handler(_timer, ^{ - @kStrongify(self) - NSLog(@"******************* 当前队列个数: %@,image loader 个数: %@", @(self.svgaQueue.count), @(self.avatarLoaders.count)); - if (self.svgaQueue.count > 0) { - dispatch_sync(dispatch_get_main_queue(), ^{ - if(self.isLargeGiftAnimating == NO){ - GiftReceiveInfoModel * receiveModel = [self.svgaQueue xpSafeObjectAtIndex:0]; - if (receiveModel) { - [self createGiftSvgaAnimation:receiveModel]; - [self.svgaQueue removeObjectAtIndex:0]; - NSLog(@"******************* 执行播放 %@, self.svgaQueue num: %@", receiveModel.targetAvatar, @(self.svgaQueue.count)); - } - } - }); - }else { - dispatch_source_cancel(_timer); - self.giftEffectTimer = nil; - } - }); - dispatch_resume(_timer); - self.giftEffectTimer = _timer; -} --(void)createGiftSvgaAnimation:(GiftReceiveInfoModel *)receiveInfo{ - GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo; - if (!giftInfo) { - giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId]; - } - if ((giftInfo.otherViewType == GiftOtherViewTypeMp4 || giftInfo.otherViewType == GiftOtherViewTypePag) && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) { - if(giftInfo.otherViewType == GiftOtherViewTypePag){ - [self largeGiftStopCarEffect:giftInfo.goldPrice]; - [self playGiftEffectWithPagUrl:giftInfo.viewUrl]; - }else{ - [self largeGiftStopCarEffect:giftInfo.goldPrice]; - self.mp4TempReceiveInfoModel = receiveInfo; - [self playGiftEffectWithVapUrl:giftInfo.viewUrl]; - } - } - if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) { - [self largeGiftStopCarEffect:giftInfo.goldPrice]; - [self playGiftEffect:giftInfo.vggUrl]; - } - [[NSNotificationCenter defaultCenter] postNotificationName:@"kExchangeRoomAnimationViewAndGameViewIndex" - object:nil]; -} - -- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo { - - [self createGiftBroadcastViewAnimation:receiveInfo]; - -} - -- (void)largeGiftStopCarEffect:(double)goldPrice { - if ([ClientConfig shareConfig].configInfo.hideCarEffectGiftPrice <= goldPrice) { - self.isLargeGiftAnimating = YES; - [self.carEffectView stopAnimation]; - [self.carVapEffectView stopHWDMP4]; - [self.carPagView stop]; - [self.carEffectQueue removeAllObjects]; - } -} - -- (NSArray *)makeBannerUsers { - NSArray * microArray = [self.delegate getMicroQueue].allValues; - NSMutableArray * array = [NSMutableArray array]; - [microArray enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - XPGiftBannerUserInfoModel * bannserUser = [[XPGiftBannerUserInfoModel alloc] init]; - bannserUser.position = obj.microState.position; - bannserUser.uid = obj.userInfo.uid; - [array addObject:bannserUser]; - }]; - return array; -} - - -///播放礼物特效 SVGA的 -- (void)playGiftEffect:(NSString *)vggUrl { - if ([self isInSudGame]) {return;} - NSString *encodingUrl = [vggUrl pureURLString]; - NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject]; - NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName]; - if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){ - NSData *data = [NSData dataWithContentsOfFile:fullPath options:0 error:NULL]; - @kWeakify(self); - [self.parser parseWithData:data cacheKey:fileName completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - @kStrongify(self); - if (videoItem != nil) { - self.giftEffectView.hidden = NO; - if (self.giftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.giftEffectView]; - [self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - CGFloat width = videoItem.videoSize.width; - CGFloat height = videoItem.videoSize.height; - if (width > height) { - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } else {//高大于宽 - CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度 - if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充 - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFill; - } else {//小于屏幕高度, - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } - } - self.giftEffectView.alpha = 1; - self.giftEffectView.loops = 1; - self.giftEffectView.clearsAfterStop = YES; - self.giftEffectView.videoItem = videoItem; - [self.giftEffectView startAnimation]; - } else { - self.isLargeGiftAnimating = NO; - } - } failureBlock:^(NSError * _Nonnull error) { - @kStrongify(self); - self.giftEffectView.hidden = YES; - self.isLargeGiftAnimating = NO; - }]; - } else { - @kWeakify(self); - [self.parser parseWithURL:[NSURL URLWithString:encodingUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { - @kStrongify(self); - if (videoItem != nil) { - self.giftEffectView.hidden = NO; - if (self.giftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.giftEffectView]; - [self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - CGFloat width = videoItem.videoSize.width; - CGFloat height = videoItem.videoSize.height; - if (width > height) { - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } else {//高大于宽 - CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度 - if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充 - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFill; - } else {//小于屏幕高度, - self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } - } - self.giftEffectView.alpha = 1; - self.giftEffectView.loops = 1; - self.giftEffectView.clearsAfterStop = YES; - self.giftEffectView.videoItem = videoItem; - [self.giftEffectView startAnimation]; - return; - } - self.isLargeGiftAnimating = NO; - } failureBlock:^(NSError * _Nullable error) { - @kStrongify(self); - self.giftEffectView.hidden = YES; - self.isLargeGiftAnimating = NO; - }]; - } -} -///播放礼物特效 pag的 -- (void)playGiftEffectWithPagUrl:(NSString *)pagUrl { - if ([self isInSudGame]) {return;} - [self.vapParser parseWithURL:pagUrl completionBlock:^(NSString * _Nullable videoUrl) { - self.giftPagView.hidden = NO; - if(self.giftPagView.superview == nil){ - [self.middleLevelView addSubview:self.giftPagView]; - [self.giftPagView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - [self.giftPagView setPath:videoUrl]; - self.giftPagView.userInteractionEnabled = NO; - self.giftPagView.repeatCount = 1; - self.giftPagView.scaleMode = PAGScaleModeStretch; - [self.giftPagView play]; - } - - } failureBlock:^(NSError * _Nullable error) { - self.giftPagView.hidden = YES; - }]; -} -///播放礼物特效 vap的 -- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl { - NSString *encodingUrl = [vapUrl pureURLString]; - NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject]; - NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName]; - - self.avatarLoaders = @[].mutableCopy; - - if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){ - vapUrl = fullPath; - - self.vapGiftEffectView.hidden = NO; - if (self.vapGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.vapGiftEffectView]; - [self.vapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - [self.vapGiftEffectView setMute:NO]; - [self.vapGiftEffectView playHWDMP4:vapUrl repeatCount:1 delegate:self]; - }else { - @kWeakify(self); - [self.vapParser parseWithURL:encodingUrl completionBlock:^(NSString * _Nullable videoUrl) { - @kStrongify(self); - if (videoUrl.length) { - self.vapGiftEffectView.hidden = NO; - if (self.vapGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.vapGiftEffectView]; - [self.vapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - [self.vapGiftEffectView setMute:NO]; - [self.vapGiftEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self]; - } - } failureBlock:^(NSError * _Nullable error) { - self.vapGiftEffectView.hidden = YES; - }]; - } -} - -///播放礼物特效 SVGA的 -- (void)playLuckyGiftEffect:(NSURL *)vggUrl { - if ([self isInSudGame]) {return;} - - NSString *encodingUrl = [vggUrl.absoluteString pureURLString]; - NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject]; - NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName]; - if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){ - NSData *data=[NSData dataWithContentsOfFile:fullPath options:0 error:NULL]; - [self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - if (videoItem != nil) { - self.luckyGiftEffectView.hidden = NO; - if (self.luckyGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.luckyGiftEffectView]; - [self.luckyGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - CGFloat width = videoItem.videoSize.width; - CGFloat height = videoItem.videoSize.height; - if (width > height) { - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } else {//高大于宽 - CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度 - if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充 - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFill; - } else {//小于屏幕高度, - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } - } - self.luckyGiftEffectView.alpha = 1; - self.luckyGiftEffectView.loops = 1; - self.luckyGiftEffectView.clearsAfterStop = YES; - self.luckyGiftEffectView.videoItem = videoItem; - [self.luckyGiftEffectView startAnimation]; - } - } failureBlock:^(NSError * _Nonnull error) { - self.luckyGiftEffectView.hidden = YES; - }]; - return; - - }; - - - [self.parser parseWithURL:[NSURL URLWithString:encodingUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) { - if (videoItem != nil) { - self.luckyGiftEffectView.hidden = NO; - if (self.luckyGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.luckyGiftEffectView]; - [self.luckyGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - CGFloat width = videoItem.videoSize.width; - CGFloat height = videoItem.videoSize.height; - if (width > height) { - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } else {//高大于宽 - CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度 - if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充 - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFill; - } else {//小于屏幕高度, - self.luckyGiftEffectView.contentMode = UIViewContentModeScaleAspectFit; - } - } - self.luckyGiftEffectView.alpha = 1; - self.luckyGiftEffectView.loops = 1; - self.luckyGiftEffectView.clearsAfterStop = YES; - self.luckyGiftEffectView.videoItem = videoItem; - [self.luckyGiftEffectView startAnimation]; - } - } failureBlock:^(NSError * _Nullable error) { - self.luckyGiftEffectView.hidden = YES; - }]; -} - -///播放礼物特效 vap的 -- (void)playLuckyGiftEffectWithVapUrl:(NSString *)vapUrl { - NSString *encodingUrl = [vapUrl pureURLString]; - encodingUrl = [encodingUrl stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; - NSString *fileName = [[encodingUrl componentsSeparatedByString:@"/"] lastObject]; - NSString *fullPath = [self.GiftDynamicEffectListPath stringByAppendingPathComponent:fileName]; - - if ([[NSFileManager defaultManager] fileExistsAtPath:fullPath]){ - vapUrl = fullPath; - self.luckyVapGiftEffectView.hidden = NO; - if (self.luckyVapGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.luckyVapGiftEffectView]; - [self.luckyVapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - [self.luckyVapGiftEffectView setMute:NO]; - [self.luckyVapGiftEffectView playHWDMP4:vapUrl repeatCount:1 delegate:self]; - } else { - @kWeakify(self); - [self.vapParser parseWithURL:encodingUrl completionBlock:^(NSString * _Nullable videoUrl) { - @kStrongify(self); - if (videoUrl.length) { - self.luckyVapGiftEffectView.hidden = NO; - if (self.luckyVapGiftEffectView.superview == nil) { - [self.middleLevelView addSubview:self.luckyVapGiftEffectView]; - [self.luckyVapGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.center.mas_equalTo(self.middleLevelView); - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenHeight); - }]; - } - [self.luckyVapGiftEffectView setMute:NO]; - [self.luckyVapGiftEffectView playHWDMP4:videoUrl repeatCount:1 delegate:self]; - } - } failureBlock:^(NSError * _Nullable error) { - self.luckyVapGiftEffectView.hidden = YES; - }]; - } -} - -#pragma mark - -- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player { - if (player == self.giftEffectView) { - self.giftEffectView.hidden = YES; - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - } else if (player == self.luckyGiftEffectView) { - self.luckyGiftEffectView.hidden = YES; - } else if(player == self.carEffectView) { - self.carEffectView.hidden = YES; - [self.carEffectView removeFromSuperview]; - if (self.carEffectQueue.count > 0) { - [self.carEffectQueue removeObjectAtIndex:0]; - } - if (self.carEffectQueue.count > 0) { - [self playCarEffect:self.carEffectQueue.firstObject]; - } - } else if(player == self.enterEffectView) { - self.enterEffectView.hidden = YES; - [self.enterEffectView removeFromSuperview]; - if (self.enterEffectQueue.count > 0) { - [self.enterEffectQueue removeObjectAtIndex:0]; - } - if (self.enterEffectQueue.count > 0) { - NSString * title = [self.enterEffectQueue.firstObject objectForKey:@"title"]; - NSInteger experLevelSeq = [(NSString *)[self.enterEffectQueue.firstObject objectForKey:@"experLevelSeq"] integerValue]; - NSString *effectPath = [self.enterEffectQueue.firstObject objectForKey:@"effectPath"]; - [self playUserEnterRoomAnimation:title experLevelSeq:experLevelSeq effectPath:effectPath]; - } - } -} - -#pragma mark - CP 礼物 -- (void)receiveCPEvent:(AttachmentModel *)attachment { - [self.roomEffectModelsQueueV2 addObject:attachment]; - if (!self.isRoomEffectV2Displaying) { - [self processNextRoomEffectAttachment]; - } -} - -- (void)playCPBinding:(AttachmentModel *)attachment { - @kWeakify(self); - [CPBindingAnimation display:self - with:attachment - complete:^{ - @kStrongify(self); - [self processNextRoomEffectAttachment]; - }]; -} - -- (void)playCPGiftBanner:(AttachmentModel *)attachMent { - @kWeakify(self); - [CPGiftBanner display:self - with:attachMent - complete:^{ - @kStrongify(self); - [self processNextRoomEffectAttachment]; - }]; -} - -- (void)playCPLevelUp:(AttachmentModel *)attachMent { - @kWeakify(self); - [CPLevelUpAnimation display:self - with:attachMent - complete:^{ - @kStrongify(self); - [self processNextRoomEffectAttachment]; - }]; -} - -#pragma mark - 新礼物等级背景 -- (void)receiveRoomGiftBanner:(AttachmentModel *)obj { - [self.roomEffectModelsQueueV2 addObject:obj]; - if (!self.isRoomEffectV2Displaying) { - [self processNextRoomEffectAttachment]; - } -} - -- (void)playRoomGiftBanner:(AttachmentModel *)obj { - @kWeakify(self); - [RoomHighValueGiftBannerAnimation display:self - with:obj - complete:^{ - @kStrongify(self); - [self processNextRoomEffectAttachment]; - }]; -} - -#pragma mark - 心愿礼物 -- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment { - CGFloat x = random() % (int)(KScreenWidth - 200); - CGFloat y= random() % 40 + kNavigationHeight; - if (self.wishGiftEffectView.superview == nil) { - [self.lowLevelView addSubview:self.wishGiftEffectView]; - - [self.wishGiftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(x); - make.top.mas_equalTo(y); - make.width.mas_equalTo(200); - make.height.mas_equalTo(167); - }]; - } - - [self.wishGiftEffectView mas_updateConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(x); - make.top.mas_equalTo(y); - }]; - NSString * anatomiser1Name = [NSString stringWithFormat:@"%@/room_wish_gift_sendCelebrate.svga", API_Image_URL]; - [self.parser parseWithURL:[NSURL URLWithString:anatomiser1Name] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) { - self.wishGiftEffectView.alpha = 1; - self.wishGiftEffectView.loops = 1; - self.wishGiftEffectView.clearsAfterStop = YES; - self.wishGiftEffectView.videoItem = videoItem; - [self.wishGiftEffectView startAnimation]; - } failureBlock:^(NSError * _Nonnull error) { - - }]; -} - -#pragma mark - HWDMP4PlayDelegate -//即将开始播放时询问,true马上开始播放,false放弃播放 -- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config { - CGFloat width = config.info.size.width; - CGFloat height = config.info.size.height; - - container.center = self.center; - [container mas_updateConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(KScreenWidth); - make.height.mas_equalTo(KScreenWidth * height / width); - }]; - return YES; -} - -- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container { - dispatch_async(dispatch_get_main_queue(), ^{ - container.hidden = YES; - if (container == self.carVapEffectView) { - [self.carVapEffectView removeFromSuperview]; - self.carVapEffectView = nil; - if (self.carEffectQueue.count > 0) { - [self.carEffectQueue removeObjectAtIndex:0]; - } - if (self.carEffectQueue.count > 0) { - [self playCarEffect:self.carEffectQueue.firstObject]; - } - } else if (container == self.vapGiftEffectView) { - [self.vapGiftEffectView removeFromSuperview]; - self.vapGiftEffectView = nil; - self.mp4TempReceiveInfoModel = nil; - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - } else if(container == self.luckyVapGiftEffectView) { - [self.luckyVapGiftEffectView removeFromSuperview]; - self.luckyVapGiftEffectView = nil; - } - }); -} - -- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container { - dispatch_async(dispatch_get_main_queue(), ^{ - container.hidden = YES; - if (container == self.carVapEffectView) { - [self.carVapEffectView removeFromSuperview]; - self.carVapEffectView = nil; - if (self.carEffectQueue.count > 0) { - [self.carEffectQueue removeObjectAtIndex:0]; - } - if (self.carEffectQueue.count > 0) { - [self playCarEffect:self.carEffectQueue.firstObject]; - } - } else if (container == self.vapGiftEffectView) { - [self.vapGiftEffectView removeFromSuperview]; - self.vapGiftEffectView = nil; - self.mp4TempReceiveInfoModel = nil; - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - } else if(container == self.luckyVapGiftEffectView) { - [self.luckyVapGiftEffectView removeFromSuperview]; - self.luckyVapGiftEffectView = nil; - } else if(container == self.wishGiftEffectView) { - [self.wishGiftEffectView removeFromSuperview]; - self.wishGiftEffectView = nil; - } - }); -} -- (void)viewDidFailPlayMP4:(NSError *)error{ - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - self.mp4TempReceiveInfoModel = nil; -} - -- (void)loadVapImageWithURL:(NSString *)urlStr context:(NSDictionary *)context completion:(VAPImageCompletionBlock)completionBlock { - if (self.mp4TempReceiveInfoModel) { - dispatch_async(dispatch_get_main_queue(), ^{ - QGVAPSourceInfo *info = (QGVAPSourceInfo *)context[@"resource"]; - - NSLog(@" MP4 的 key - info.contentTag : %@", info.contentTag); - - if ([info.contentTag isEqualToString:@"avatar1"]) { - if ([NSString isEmpty:self.mp4TempReceiveInfoModel.avatar]) { - completionBlock(kImage(@"common_avatar"), nil, @"dafeult image"); - } else { - NSString *path = @""; - switch (self.mp4TempReceiveInfoModel.gift.showAvatarType) { - case 1: // 只使用 avatar - case 3: - path = self.mp4TempReceiveInfoModel.avatar; - break; - case 2: // 只使用 target avatar - path = self.mp4TempReceiveInfoModel.targetAvatar; - break; - default: - completionBlock(kImage(@"common_avatar"), nil, @"dafeult image"); - return; - break; - } - - NetImageView *avatar_1_Loader = [[NetImageView alloc] init]; - [avatar_1_Loader loadImageWithUrl:path completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { - completionBlock(image, nil, urlStr); - }]; - - [self.avatarLoaders addObject:avatar_1_Loader]; - } - } - else if ([info.contentTag isEqualToString:@"avatar2"] ) { - GiftReceiveInfoModel *infoModel = self.mp4TempReceiveInfoModel;// [self.embeddedTargetDatas lastObject]; - if (!infoModel || [NSString isEmpty:infoModel.targetAvatar]) { - completionBlock(kImage(@"common_avatar"), nil, @"dafeult image"); - } else { - - NetImageView *avatar_2_Loader = [[NetImageView alloc] init]; - [avatar_2_Loader loadImageWithUrl:infoModel.targetAvatar completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { - completionBlock(image, nil, urlStr); - }]; - [self.avatarLoaders addObject:avatar_2_Loader]; - } - } else { - completionBlock(kImage(@"common_avatar"), nil, @"completionBlock"); - } - }); - } -} - -- (NSString *)contentForVapTag:(NSString *)tag resource:(QGVAPSourceInfo *)info { - NSString *name1 = @""; - switch (self.mp4TempReceiveInfoModel.gift.showAvatarType) { - case 1: - case 3: - name1 = self.mp4TempReceiveInfoModel.nick; - break; - case 2: - name1 = self.mp4TempReceiveInfoModel.targetNick; - break; - default: - break; - } - NSDictionary *extraInfo = @{@"name1" : [NSString isEmpty:name1] ? @"" : name1, - @"name2" : [NSString isEmpty:self.mp4TempReceiveInfoModel.targetNick] ? @"" : self.mp4TempReceiveInfoModel.targetNick, -// @"id1" : [NSString isEmpty:self.mp4TempReceiveInfoModel.uid] ? @"" : self.mp4TempReceiveInfoModel.uid , -// @"id2" : [NSString isEmpty:infoModel.targetUid] ? @"" : infoModel.targetUid - }; - return [NSString isEmpty:extraInfo[tag]] ? @" " : extraInfo[tag]; -} - - -#pragma mark - PAGViewListener -/** - * Notifies the beginning of the animation. It can be called from either the UI thread or the thread - * that calls the play method. - */ -- (void)onAnimationStart:(PAGView*)pagView{ - -} - -/** - * Notifies the end of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationEnd:(PAGView*)pagView{ - dispatch_async(dispatch_get_main_queue(), ^{ - pagView.hidden = YES; - if (pagView == self.giftPagView) { - [self.giftPagView removeFromSuperview]; - self.giftPagView = nil; - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - }else if(pagView == self.carPagView){ - [self.carPagView removeFromSuperview]; - self.carPagView = nil; - if (self.carEffectQueue.count > 0) { - [self.carEffectQueue removeObjectAtIndex:0]; - } - if (self.carEffectQueue.count > 0) { - [self playCarEffect:self.carEffectQueue.firstObject]; - } - } - }); -} - -/** - * Notifies the cancellation of the animation. It can be called from either the UI thread or the - * thread that calls the stop method. - */ -- (void)onAnimationCancel:(PAGView*)pagView{ - dispatch_async(dispatch_get_main_queue(), ^{ - pagView.hidden = YES; - if (pagView == self.giftPagView) { - [self.giftPagView removeFromSuperview]; - self.giftPagView = nil; - if (self.isLargeGiftAnimating == YES) { - self.isLargeGiftAnimating = NO; - } - } - }); -} - -/** - * Notifies the repetition of the animation. It can only be called from the UI thread. - */ -- (void)onAnimationRepeat:(PAGView*)pagView{ - -} - -/** - * Notifies another frame of the animation has occurred. It may be called from an arbitrary - * thread if the animation is running asynchronously. - */ -- (void)onAnimationUpdate:(PAGView*)pagView{ - -} -#pragma mark - Getters And Setters -- (SVGAImageView *)giftEffectView { - if (!_giftEffectView) { - _giftEffectView = [[SVGAImageView alloc]init]; - _giftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - _giftEffectView.userInteractionEnabled = NO; - _giftEffectView.delegate = self; - _giftEffectView.hidden = YES; - } - return _giftEffectView; -} - -- (VAPView *)vapGiftEffectView { - if (!_vapGiftEffectView) { - _vapGiftEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - _vapGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - _vapGiftEffectView.contentMode = UIViewContentModeScaleAspectFill; - _vapGiftEffectView.hidden = YES; - } - return _vapGiftEffectView; -} - -- (SVGAImageView *)luckyGiftEffectView { - if (!_luckyGiftEffectView) { - _luckyGiftEffectView = [[SVGAImageView alloc]init]; - _luckyGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - _luckyGiftEffectView.userInteractionEnabled = NO; - _luckyGiftEffectView.delegate = self; - _luckyGiftEffectView.hidden = YES; - } - return _luckyGiftEffectView; -} - -- (VAPView *)luckyVapGiftEffectView { - if (!_luckyVapGiftEffectView) { - _luckyVapGiftEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - _luckyVapGiftEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5]; - _luckyVapGiftEffectView.contentMode = UIViewContentModeScaleAspectFill; - _luckyVapGiftEffectView.hidden = YES; - } - return _luckyVapGiftEffectView; -} - -- (VAPView *)carVapEffectView { - if (!_carVapEffectView) { - _carVapEffectView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; - _carVapEffectView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3]; - _carVapEffectView.contentMode = UIViewContentModeScaleAspectFill; - _carVapEffectView.hidden = YES; - } - return _carVapEffectView; -} - -- (XPRoomGiftAnimationParser *)vapParser { - if (!_vapParser) { - _vapParser = [[XPRoomGiftAnimationParser alloc] init]; - } - return _vapParser; -} - -- (SVGAParser *)parser { - if (!_parser) { - _parser = [[SVGAParser alloc]init]; - } - return _parser; -} - -- (XPRoomAnimationHitView *)lowLevelView { - if (!_lowLevelView) { - _lowLevelView = [[XPRoomAnimationHitView alloc] init]; - _lowLevelView.backgroundColor = [UIColor clearColor]; - _lowLevelView.userInteractionEnabled = YES; - } - return _lowLevelView; -} - -- (XPRoomAnimationHitView *)middleLevelView { - if (!_middleLevelView) { - _middleLevelView = [[XPRoomAnimationHitView alloc] init]; - _middleLevelView.backgroundColor = [UIColor clearColor]; - _middleLevelView.userInteractionEnabled = YES; - } - return _middleLevelView; -} - -- (XPRoomAnimationHitView *)highLevleView { - if (!_highLevleView) { - _highLevleView = [[XPRoomAnimationHitView alloc] init]; - _highLevleView.backgroundColor = [UIColor clearColor]; - _highLevleView.userInteractionEnabled = YES; - } - return _highLevleView; -} - -- (NSMutableArray *)carEffectQueue { - if (_carEffectQueue == nil) { - _carEffectQueue = [NSMutableArray array]; - } - return _carEffectQueue; -} - -- (SVGAImageView *)carEffectView { - if (_carEffectView == nil) { - _carEffectView = [[SVGAImageView alloc]init]; - _carEffectView.delegate = self; - _carEffectView.contentMode = UIViewContentModeScaleAspectFit; - _carEffectView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); - _carEffectView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3]; - _carEffectView.alpha = 0; - _carEffectView.userInteractionEnabled = NO; - } - return _carEffectView; -} - -- (NSMutableArray *)enterEffectQueue { - if (_enterEffectQueue == nil) { - _enterEffectQueue = [NSMutableArray array]; - } - return _enterEffectQueue; -} - -- (SVGAImageView *)enterEffectView { - if (_enterEffectView == nil) { - _enterEffectView = [[SVGAImageView alloc]init]; - _enterEffectView.delegate = self; - _enterEffectView.loops = 0; - _enterEffectView.clearsAfterStop = YES; - _enterEffectView.contentMode = UIViewContentModeScaleAspectFit; - _enterEffectView.frame = CGRectMake(0, 0, KScreenWidth, 40); - _enterEffectView.backgroundColor = [UIColor clearColor]; - _enterEffectView.userInteractionEnabled = NO; - } - return _enterEffectView; -} - - -- (SVGAImageView *)datingEffectView { - if (_datingEffectView == nil) { - _datingEffectView = [[SVGAImageView alloc]init]; - _datingEffectView.delegate = self; - _datingEffectView.contentMode = UIViewContentModeScaleAspectFit; - _datingEffectView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); - _datingEffectView.backgroundColor = [UIColor clearColor]; - _datingEffectView.alpha = 0; - _datingEffectView.userInteractionEnabled = NO; - } - return _datingEffectView; -} - - -- (NSMutableArray *)acrossRoomPKQueue { - if (!_acrossRoomPKQueue) { - _acrossRoomPKQueue = [NSMutableArray array]; - } - return _acrossRoomPKQueue; -} - -- (NSMutableArray *)sailingQueue { - if (!_sailingQueue) { - _sailingQueue = [NSMutableArray array]; - } - return _sailingQueue; -} - -- (NSMutableArray *)graffitiGiftQueue { - if (!_graffitiGiftQueue) { - _graffitiGiftQueue = [NSMutableArray array]; - } - return _graffitiGiftQueue; -} - - -- (SVGAImageView *)wishGiftEffectView { - if (_wishGiftEffectView == nil) { - _wishGiftEffectView = [[SVGAImageView alloc]init]; - _wishGiftEffectView.delegate = self; - _wishGiftEffectView.contentMode = UIViewContentModeScaleAspectFit; - _wishGiftEffectView.frame = CGRectMake(0, 0, 210, 183); - _wishGiftEffectView.backgroundColor = [UIColor clearColor]; - _wishGiftEffectView.alpha = 1; - _wishGiftEffectView.userInteractionEnabled = NO; - } - return _wishGiftEffectView; -} - - -- (NSMutableArray *)animationListA{ - if(!_animationListA){ - _animationListA = [NSMutableArray array]; - } - return _animationListA; -} -- (NSMutableArray *)animationListB{ - if(!_animationListB){ - _animationListB = [NSMutableArray array]; - } - return _animationListB; -} -- (NSMutableArray *)svgaQueue{ - if(!_svgaQueue){ - _svgaQueue = [NSMutableArray array]; - } - return _svgaQueue; -} -- (PAGView *)giftPagView{ - if(!_giftPagView){ - _giftPagView = [[PAGView alloc]init]; - [_giftPagView addListener:self]; - _giftPagView.backgroundColor = [UIColor clearColor]; - } - return _giftPagView; -} -- (PAGView *)carPagView{ - if(!_carPagView){ - _carPagView = [[PAGView alloc]init]; - [_carPagView addListener:self]; - _carPagView.backgroundColor = [UIColor clearColor]; - } - return _carPagView; -} -- (CGFloat)broadCastHieght{ - if(_broadCastHieght == 0){ - _broadCastHieght = 190 - 150 + kGetScaleWidth(69); - } - return _broadCastHieght; -} - -@end diff --git a/YuMi/Modules/YMRoom/View/ArrangeMic/Api/Api+ArrangeMic.h b/YuMi/Modules/YMRoom/View/ArrangeMic/Api/Api+ArrangeMic.h index 7eb1f9d2..f7db90af 100644 --- a/YuMi/Modules/YMRoom/View/ArrangeMic/Api/Api+ArrangeMic.h +++ b/YuMi/Modules/YMRoom/View/ArrangeMic/Api/Api+ArrangeMic.h @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN /// 获取当前房间PK的长度 /// @param completion 完成 /// @param roomUid 房主的uid -+ (void)getRoomPKSize:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; +//+ (void)getRoomPKSize:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid; /// 申请房间内PK排麦 /// @param completion 完成 diff --git a/YuMi/Modules/YMRoom/View/LittleGame/View/XPLittleGameRoomOpenView.m b/YuMi/Modules/YMRoom/View/LittleGame/View/XPLittleGameRoomOpenView.m index f79fec6d..c9e274c4 100644 --- a/YuMi/Modules/YMRoom/View/LittleGame/View/XPLittleGameRoomOpenView.m +++ b/YuMi/Modules/YMRoom/View/LittleGame/View/XPLittleGameRoomOpenView.m @@ -172,7 +172,7 @@ [collectionView deselectItemAtIndexPath:indexPath animated:YES]; LittleGameInfoModel * gameInfo = [self.datasource xpSafeObjectAtIndex:indexPath.row]; self.selectGameInfo = gameInfo; - [self.collectionView reloadData]; + [self.collectionView reloadData]; self.createRoomButton.enabled = YES; } diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.h new file mode 100644 index 00000000..0f208c8b --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.h @@ -0,0 +1,29 @@ +// +// LuckyPackageBannerView.h +// YuMi +// +// Created by P on 2025/2/12. +// + +#import + +@class AttachmentModel; + +NS_ASSUME_NONNULL_BEGIN + +@interface LuckyPackageBannerView : UIView + +@property (nonatomic, copy) void(^didTapBanner)(NSInteger roomID); + ++ (void)display:(UIView *)superView + inRoomUid:(NSInteger)roomUid + with:(AttachmentModel *)attachment + complete:(void(^)(void))complete +exitCurrentRoom:(void(^)(void))exit; + ++ (LuckyPackageBannerView *)demoBanner; +- (void)updateDemoFor:(NSInteger)type nick:(NSString *)nick avatar:(NSString *)avatar; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m new file mode 100644 index 00000000..2e603f7a --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageBannerView.m @@ -0,0 +1,266 @@ +// +// LuckyPackageBannerView.m +// YuMi +// +// Created by P on 2025/2/12. +// + +#import "LuckyPackageBannerView.h" +#import + +#import "AttachmentModel.h" +#import "XPRoomViewController.h" +#import "XCCurrentVCStackManager.h" +//{"data":{"beginTime":1739348804074,"kind":5,"redEnvelopeId":28,"redEnvelopeNum":2,"redEnvelopeType":"GIFT","roomTitle":"hansome's Room","roomUid":3184,"sendUserAvatar":"https://image.pekolive.com/image/0eaecfbbb78f600a0bbdde3e3a64d66e.gif","sendUserNick":"hansome","timestamp":1739347604265,"type":"GIFT"},"first":60,"second":607} + +@interface LuckyPackageBannerViewModel : PIBaseModel + +@property (nonatomic, assign, readonly) NSTimeInterval beginTime; +@property (nonatomic, assign, readonly) NSInteger kind; +@property (nonatomic, assign, readonly) NSInteger redEnvelopeId; +@property (nonatomic, assign, readonly) NSInteger redEnvelopeNum; +@property (nonatomic, assign, readonly) NSInteger roomUid; +@property (nonatomic, assign, readonly) NSTimeInterval timestamp; +@property (nonatomic, copy, readonly) NSString *redEnvelopeType; +@property (nonatomic, copy, readonly) NSDictionary *giftNameMap; +@property (nonatomic, copy, readonly) NSString *roomTitle; +@property (nonatomic, copy, readonly) NSString *sendUserAvatar; +@property (nonatomic, copy, readonly) NSString *sendUserNick; +@property (nonatomic, copy, readonly) NSString *type; + +@end + +@implementation LuckyPackageBannerViewModel + +@end + +@interface LuckyPackageBannerView() + +@property (nonatomic, strong) LuckyPackageBannerViewModel *model; + +@property (nonatomic, strong) UIImageView *backgroundImageView; +@property (nonatomic, strong) NetImageView *avatarImageView; +@property (nonatomic, strong) UILabel *titleLabel; +@property (nonatomic, strong) UILabel *subTitleLabel; +@property (nonatomic, strong) UIButton *goButton; +@property (nonatomic, assign) NSInteger currentRoomUid; +@property (nonatomic, copy) void(^completeDisplay)(void); +@property (nonatomic, copy) void(^exitCurrentRoom)(void); + +@end + +@implementation LuckyPackageBannerView + ++ (void)display:(UIView *)superView + inRoomUid:(NSInteger)roomUid + with:(AttachmentModel *)attachment + complete:(void(^)(void))complete +exitCurrentRoom:(void(^)(void))exit { + LuckyPackageBannerViewModel *model = [LuckyPackageBannerViewModel modelWithDictionary:attachment.data]; + + CGRect frame = CGRectMake(KScreenWidth, 0, KScreenWidth, kGetScaleWidth(100)); + LuckyPackageBannerView *banner = [[LuckyPackageBannerView alloc] initWithFrame:frame]; + banner.model = model; + banner.completeDisplay = complete; + banner.exitCurrentRoom = exit; + banner.currentRoomUid = roomUid; + [banner addNotification]; + [superView addSubview:banner]; + + @kWeakify(banner); + [banner popEnterAnimation:^(BOOL finished) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + @kStrongify(banner); + [banner popLeaveAnimation:^(bool finished) { + if (banner.completeDisplay) { + banner.completeDisplay(); + } + [banner removeFromSuperview]; + }]; + }); + }]; +} + +- (void)updateDemoFor:(NSInteger)type nick:(NSString *)nick avatar:(NSString *)avatar { + self.avatarImageView.imageUrl = avatar; + self.titleLabel.text = nick; + + if (type == 1) { + self.backgroundImageView.image = kImage(@"luck_package_banner_gift"); + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_24"); + } else { + self.backgroundImageView.image = kImage(@"luck_package_banner_coin"); + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_25"); + } +} + ++ (LuckyPackageBannerView *)demoBanner { + CGRect frame = CGRectMake(KScreenWidth, 80, KScreenWidth, kGetScaleWidth(100)); + LuckyPackageBannerView *banner = [[LuckyPackageBannerView alloc] initWithFrame:frame]; + return banner; +} + +- (void)addNotification { + @kWeakify(self); + [[NSNotificationCenter defaultCenter] addObserverForName:@"SwipeOutBanner" + object:nil + queue:[NSOperationQueue mainQueue] + usingBlock:^(NSNotification * _Nonnull notification) { + @kStrongify(self); + [self dismissBanner]; + }]; +} + +- (void)dismissBanner { + [self pop_removeAllAnimations]; // 停止所有动画 + + [self popLeaveAnimation:^(bool finished) { + if (self.completeDisplay) { + self.completeDisplay(); + } + [self removeFromSuperview]; + }]; +} + +- (void)popEnterAnimation:(void(^)(BOOL finished))finish { + POPSpringAnimation *enterAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewFrame]; + enterAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(0, 0, KScreenWidth, kGetScaleWidth(100))]; + enterAnimation.springBounciness = 10; // 弹性系数 + enterAnimation.springSpeed = 12; // 动画速度 + enterAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) { + if (finish) { + finish(finished); + } + }; + [self pop_addAnimation:enterAnimation forKey:@"enterAnimation"]; +} + +- (void)popLeaveAnimation:(void(^)(bool finished))finish { + POPBasicAnimation *exitAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame]; + exitAnimation.toValue = [NSValue valueWithCGRect:CGRectMake(-KScreenWidth, 0, KScreenWidth, kGetScaleWidth(100))]; + exitAnimation.duration = 0.25; // 动画持续时间 + exitAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + exitAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) { + if (finish) { + finish(finished); + } + }; + [self pop_addAnimation:exitAnimation forKey:@"exitAnimation"]; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self addSubview:self.backgroundImageView]; + [self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + [self addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self).offset(-7); + make.leading.mas_equalTo(self).offset(29); + make.width.height.mas_equalTo(kGetScaleWidth(36)); + }]; + + [self addSubview:self.titleLabel]; + [self addSubview:self.subTitleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView).offset(1); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(4); + }]; + [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(-7); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(4); + }]; + + [self addSubview:self.goButton]; + [self.goButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.avatarImageView); + make.trailing.mas_equalTo(self).offset(-29); + make.size.mas_equalTo(CGSizeMake(45, 27)); + }]; + } + return self; +} + +- (void)setModel:(LuckyPackageBannerViewModel *)model { + _model = model; + if ([model.redEnvelopeType isEqualToString:@"GIFT"]) { + self.backgroundImageView.image = kImage(@"luck_package_banner_gift"); + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_15.1"); + } else { + self.backgroundImageView.image = kImage(@"luck_package_banner_coin"); + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_15.2"); + } + self.avatarImageView.imageUrl = model.sendUserAvatar; + self.titleLabel.text = model.sendUserNick; + +} + +- (void)handleTapGo { + if (self.model.roomUid == self.currentRoomUid) { + return; + } + + @kWeakify(self); + [TTPopup alertWithMessage:YMLocalizedString(@"Combo_10") confirmHandler:^{ + @kStrongify(self); + if (self.exitCurrentRoom) { + self.exitCurrentRoom(); + } + NSString *targetRoomUid = @(self.model.roomUid).stringValue; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [XPRoomViewController openRoom:targetRoomUid + viewController:[XCCurrentVCStackManager shareManager].getCurrentVC]; + }); + } cancelHandler:^{}]; +} + +#pragma mark - +- (UIImageView *)backgroundImageView { + if (!_backgroundImageView) { + _backgroundImageView = [[UIImageView alloc] init]; + _backgroundImageView.contentMode = UIViewContentModeScaleAspectFill; + } + return _backgroundImageView; +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeCornerAvatar; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.backgroundColor = [UIColor clearColor]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setAllCornerRadius:kGetScaleWidth(18) borderWidth:1 borderColor:UIColorFromRGB(0xffea5c)]; + } + return _avatarImageView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0xffea5c)]; + } + return _titleLabel; +} + +- (UILabel *)subTitleLabel { + if (!_subTitleLabel) { + _subTitleLabel = [UILabel labelInitWithText:@"" font:kFontRegular(14) textColor:UIColorFromRGB(0xffea5c)]; + } + return _subTitleLabel; +} + +- (UIButton *)goButton { + if (!_goButton) { + _goButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_goButton setBackgroundImage:kImage(@"luck_package_banner_go") forState:UIControlStateNormal]; + [_goButton addTarget:self action:@selector(handleTapGo) forControlEvents:UIControlEventTouchUpInside]; + } + return _goButton; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.h index a3d5c15f..83ae0d11 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.h +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.h @@ -6,11 +6,77 @@ // #import - +@class GiftInfoModel, WalletInfoModel, RoomLuckyPackageInfoModel, OpenRedEnvelopeVo, AttachmentModel, RedEnvelopeReceiveVo; NS_ASSUME_NONNULL_BEGIN @interface LuckyPackageLogicManager : NSObject +@property(nonatomic, strong) NSString *roomUid; + ++ (instancetype)sharedInstance; + +- (void)reset; + +- (void)requestRoomLuckyPackageAPI:(NSInteger)roomUid success:(void(^)(RoomLuckyPackageInfoModel *model))success; +- (void)requestOpenLockyPackageAPI:(NSInteger)packageID success:(void(^)(OpenRedEnvelopeVo *model))success failure:(void(^)(NSError *error))failure; +- (void)requestLuckyPackageReceiversAPI:(NSInteger)packageID success:(void(^)(NSArray *array))success failure:(void(^)(NSError *error))failure; +- (void)saveWalletInfo:(WalletInfoModel *)info; +- (WalletInfoModel *)loadSavedWalletInfo; + +- (void)receiveNewPostLuckyPackage:(AttachmentModel *)obj; +- (void)removeReceivedLuckyPackage; + +- (void)registerLuckyPackageUpdate:(void(^)(RoomLuckyPackageInfoModel *model))block; + +/// 更新选中的礼物 +- (void)updateSelectedGift:(GiftInfoModel *)gift + count:(NSInteger)count; +/// 更新礼物红包的等待时间 +- (void)updateSelectedGiftWaitingTime:(NSInteger)time; +/// 注册礼物红包总成本的内容更新 block +- (void)registerGiftTotalCostString:(void(^)(NSAttributedString *content))block key:(NSString *)key; +- (void)removeGiftTotalCostRegister:(NSString *)key; +/// 注册金币红包总成本的内容更新 block +- (void)registerCoinTotalCostString:(void(^)(NSString *content))block; +/// 获取最新的礼物红包总成本 +//- (NSString *)loadGiftTotalCostString; +- (NSAttributedString *)loadGiftTotalCostString; +/// 获取最新的金币红包总成本 +- (NSString *)loadCoinTotalCostString; +/// 更新选中金币红包的金额 +- (void)updateSelectedBag:(NSInteger)money; +/// 更新选中金币红包的数量 +- (void)updateSelectedBagNum:(NSInteger)num; +/// 更新金币红包的等待时间 +- (void)updateSelectedBagWaitingTime:(NSInteger)time; +/// 获取最新的礼物红包等待时间 +- (NSInteger)loadGiftWaitingTime; +/// 获取最新的金币红包等待时间 +- (NSInteger)loadCoinWaitingTime; +/// 获取最新的金币红包选中金额 +- (NSInteger)loadSelectedBagMoney; +/// 获取最新的金币红包选中数量 +- (NSInteger)loadSelectedBagNum; +/// 获取礼物红包中所有选中的礼物 +- (NSArray *)loadAllSelectedGifts; +/// 获取礼物红包中所有选中的礼物的总数 +- (NSInteger)numberOfGifts; +/// 获取礼物红包中指定下标的礼物 +- (GiftInfoModel *)giftForIndex:(NSInteger)index; +/// 获取礼物红包中指定下标的礼物数量 +- (NSInteger)countOfGiftForIndex:(NSInteger)index; +/// 获取配置中的所有等待时间(单位:秒) +- (NSArray *)loadConfigWaitingTimes; +/// 获取配置中的所有等待时间(单位:分) +- (NSArray *)loadConfigWaitingTimesMins; +/// 获取配置中的金币红包可选数量 +- (NSArray *)loadConfigLuckyBagNumbers; +/// 获取配置中的金币红包可选金额 +- (NSArray *)loadConfigLuckyBagMoneys; +/// 获取红包数量 +- (NSInteger)packageBadgeNum; + + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.m index b8a3a6fa..e2d14d41 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.m +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageLogicManager.m @@ -7,6 +7,311 @@ #import "LuckyPackageLogicManager.h" +#import "GiftInfoModel.h" +#import "AttachmentModel.h" +#import "WalletInfoModel.h" +#import "LuckyPackagePresenter.h" + +@interface LuckyPackageLogicManager() + +@property(nonatomic, strong) WalletInfoModel *walletInfo; +@property(nonatomic, strong) RoomLuckyPackageInfoModel *infoModel; + +// 礼物红包 +@property(nonatomic, strong) NSMutableArray *selectedGiftModels; +@property(nonatomic, strong) NSMutableArray *selectedGiftCounts; +@property(nonatomic, assign) NSInteger selectedWaitingTime_gift; +@property(nonatomic, strong) NSMutableAttributedString *totalCostString_Gift; +//@property(nonatomic, copy) void(^giftTotalCostBlock)(NSString *content); + +@property(nonatomic, strong) NSMutableArray *giftTotalCostBlockArray; + +// 金币红包 +@property(nonatomic, assign) NSInteger selectedWaitingTime_coin; +@property(nonatomic, assign) NSInteger selectedBagMoney; +@property(nonatomic, assign) NSInteger selectedBagCount; +@property(nonatomic, copy) NSString *totalCostString_Coin; + +@property(nonatomic, assign) NSInteger packageNum; + +@property(nonatomic, copy) void(^coinTotalCostBlock)(NSString *content); +@property(nonatomic, copy) void(^luckyPackageUpdate)(RoomLuckyPackageInfoModel *model); +@end + @implementation LuckyPackageLogicManager ++ (instancetype)sharedInstance { + static LuckyPackageLogicManager *instance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[self alloc] init]; + instance.selectedGiftCounts = @[].mutableCopy; + instance.selectedGiftModels = @[].mutableCopy; + instance.giftTotalCostBlockArray = @[].mutableCopy; + }); + + return instance; +} + +- (void)requestRoomLuckyPackageAPI:(NSInteger)roomUid success:(void(^)(RoomLuckyPackageInfoModel *model))success{ + [self reset]; + LuckyPackagePresenter *presenter = [[LuckyPackagePresenter alloc] init]; + @kWeakify(self); + [presenter loadRoomLuckyPackageInfo:roomUid success:^(RoomLuckyPackageInfoModel * _Nonnull model) { + @kStrongify(self); + NSArray *temp = [model.redEnvelopeListVoList sortedArrayUsingComparator:^NSComparisonResult(RedEnvelopeListVo * _Nonnull obj1, RedEnvelopeListVo * _Nonnull obj2) { + return [@(obj1.beginTime) compare:@(obj2.beginTime)]; + }]; + model.redEnvelopeListVoList = temp; + self.packageNum = model.redEnvelopeListVoList.count; + self.infoModel = model; + self.selectedWaitingTime_coin = [[model.redEnvelopeV2Config.timeItems xpSafeObjectAtIndex:0] integerValue]; + self.selectedWaitingTime_gift = [[model.redEnvelopeV2Config.timeItems xpSafeObjectAtIndex:0] integerValue]; + [self updateSelectedBag:[[model.redEnvelopeV2Config.goldItems xpSafeObjectAtIndex:0] integerValue]]; + [self updateSelectedBagNum:[[model.redEnvelopeV2Config.numItems xpSafeObjectAtIndex:0] integerValue]]; + if (success) { + success(model); + } + }]; +} + +- (void)receiveNewPostLuckyPackage:(AttachmentModel *)obj { + NSDictionary *data = obj.data; + if (data) { + RedEnvelopeListVo *vo = [RedEnvelopeListVo modelWithJSON:data]; + if (vo.roomUid != self.roomUid.integerValue) { + return; + } + + vo.avatar = [data objectForKey:@"sendUserAvatar"]; + vo.nick = [data objectForKey:@"sendUserNick"]; + NSMutableArray *temp = [self.infoModel.redEnvelopeListVoList mutableCopy]; + [temp addObject:vo]; + self.infoModel.redEnvelopeListVoList = [temp sortedArrayUsingComparator:^NSComparisonResult(RedEnvelopeListVo * _Nonnull obj1, RedEnvelopeListVo * _Nonnull obj2) { + return [@(obj1.beginTime) compare:@(obj2.beginTime)]; + }]; + self.packageNum = self.infoModel.redEnvelopeListVoList.count; + if (_luckyPackageUpdate) { + self.luckyPackageUpdate(self.infoModel); + } + } +} + +- (void)removeReceivedLuckyPackage { + NSMutableArray *array = [self.infoModel.redEnvelopeListVoList mutableCopy]; + if (array.count>0) { + [array removeObjectAtIndex:0]; + } + self.infoModel.redEnvelopeListVoList = array.copy; + self.packageNum = self.infoModel.redEnvelopeListVoList.count; + if (_luckyPackageUpdate) { + self.luckyPackageUpdate(self.infoModel); + } +} + +- (void)registerLuckyPackageUpdate:(void(^)(RoomLuckyPackageInfoModel *model))block { + _luckyPackageUpdate = block; +} + +- (void)requestOpenLockyPackageAPI:(NSInteger)packageID success:(void(^)(OpenRedEnvelopeVo *model))success failure:(void(^)(NSError *error))failure { + LuckyPackagePresenter *presenter = [[LuckyPackagePresenter alloc] init]; + [presenter open:packageID success:success failure:failure]; +} + +- (void)requestLuckyPackageReceiversAPI:(NSInteger)packageID success:(void(^)(NSArray *array))success failure:(void(^)(NSError *error))failure { + LuckyPackagePresenter *presenter = [[LuckyPackagePresenter alloc] init]; + [presenter loadReceiversOfLuckyPackage:packageID success:success failure:failure]; +} + +- (void)saveWalletInfo:(WalletInfoModel *)info { + self.walletInfo = info; +} + +- (WalletInfoModel *)loadSavedWalletInfo { + return self.walletInfo; +} + +- (void)reset { + LuckyPackagePresenter *presenter = [[LuckyPackagePresenter alloc] init]; + [presenter resetGiftsCount:[self roomUid]]; + [self.selectedGiftCounts removeAllObjects]; + [self.selectedGiftModels removeAllObjects]; + [self.giftTotalCostBlockArray removeAllObjects]; + self.selectedWaitingTime_gift = [[self.infoModel.redEnvelopeV2Config.timeItems xpSafeObjectAtIndex:0] integerValue]; + [self updateGiftTotalCostString]; + + self.selectedWaitingTime_coin = [[self.infoModel.redEnvelopeV2Config.timeItems xpSafeObjectAtIndex:0] integerValue]; + [self updateSelectedBag:[[self.infoModel.redEnvelopeV2Config.goldItems xpSafeObjectAtIndex:0] integerValue]]; + [self updateSelectedBagNum:[[self.infoModel.redEnvelopeV2Config.numItems xpSafeObjectAtIndex:0] integerValue]]; +} + +#pragma mark - 礼物红包 + + +#pragma mark - 金币红包 + +- (void)updateSelectedGift:(GiftInfoModel *)gift + count:(NSInteger)count { + NSUInteger index = [self.selectedGiftModels indexOfObjectPassingTest:^BOOL(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + return [obj isEqual:gift]; + }]; + + if (index != NSNotFound) { + [self.selectedGiftCounts replaceObjectAtIndex:index withObject:@(count)]; + } else { + [self.selectedGiftModels addObject:gift]; + [self.selectedGiftCounts addObject:@(count)]; + } + [self updateGiftTotalCostString]; +} + +- (void)updateSelectedGiftWaitingTime:(NSInteger)time { + self.selectedWaitingTime_gift = time; + [self updateGiftTotalCostString]; +} + +- (void)registerGiftTotalCostString:(void(^)(NSAttributedString *content))block key:(nonnull NSString *)key{ + // 检查是否已经存在该 key + for (NSDictionary *blockDict in self.giftTotalCostBlockArray) { + if (blockDict.allKeys.firstObject && [blockDict.allKeys.firstObject isEqualToString:key]) { + // 如果 key 已经存在,则不添加,直接返回 + return; + } + } + + [self.giftTotalCostBlockArray addObject:@{key: block}]; +} + +- (void)removeGiftTotalCostRegister:(NSString *)key { + // 查找并移除对应 key 的 block + for (NSDictionary *blockDict in self.giftTotalCostBlockArray) { + if (blockDict.allKeys.firstObject && [blockDict.allKeys.firstObject isEqualToString:key]) { + [self.giftTotalCostBlockArray removeObject:blockDict]; + break; // 找到并移除后退出循环 + } + } +} + +- (void)registerCoinTotalCostString:(void(^)(NSString *content))block { + _coinTotalCostBlock = block; +} + +- (void)updateGiftTotalCostString { + NSNumber *count = [self.selectedGiftCounts valueForKeyPath:@"@sum.self"]; + __block double price = 0; + [self.selectedGiftModels enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + NSNumber *giftCount = [self.selectedGiftCounts xpSafeObjectAtIndex:idx]; + double giftPrice = [obj goldPrice]; + price += giftCount.integerValue * giftPrice; + }]; + + NSString *string = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_11"), count, @(price)]; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:string + attributes:@{ + NSFontAttributeName : kFontRegular(12), + NSForegroundColorAttributeName : UIColorFromRGB(0xffea5c) + }]; + NSRange countRange = [string rangeOfString:count.stringValue]; + NSRange priceRange = [string rangeOfString:@(price).stringValue options:NSBackwardsSearch]; // 从后向前查找 price,避免匹配到 count + + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:countRange]; + [attributedString addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:priceRange]; + + self.totalCostString_Gift = attributedString; + for (NSDictionary *dic in self.giftTotalCostBlockArray) { + void(^block)(NSAttributedString *) = dic.allValues.firstObject; + // 执行 block,并传入所需的参数 + if (block) { + block(self.totalCostString_Gift); + } + } +} + +- (void)updateSelectedBag:(NSInteger)money { + self.selectedBagMoney = money; + [self updateCoinTotalCostString]; +} + +- (void)updateSelectedBagNum:(NSInteger)num { + self.selectedBagCount = num; + [self updateCoinTotalCostString]; +} + +- (void)updateSelectedBagWaitingTime:(NSInteger)time { + self.selectedWaitingTime_coin = time; +} + +- (void)updateCoinTotalCostString { + NSInteger totalCoast = self.selectedBagMoney;// * self.selectedBagCount; + self.totalCostString_Coin = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_9"), @(totalCoast)]; + if (_coinTotalCostBlock) { + self.coinTotalCostBlock(self.totalCostString_Coin); + } +} + +- (NSAttributedString *)loadGiftTotalCostString { + return self.totalCostString_Gift.copy; +} + +- (NSString *)loadCoinTotalCostString { + return self.totalCostString_Coin; +} + +- (NSInteger)loadGiftWaitingTime { + return self.selectedWaitingTime_gift; +} + +- (NSInteger)loadCoinWaitingTime { + return self.selectedWaitingTime_coin; +} + +- (NSInteger)loadSelectedBagMoney { + return self.selectedBagMoney; +} + +- (NSInteger)loadSelectedBagNum { + return self.selectedBagCount; +} + +- (NSArray *)loadAllSelectedGifts { + return self.selectedGiftModels; +} + +- (NSInteger)numberOfGifts { + return self.selectedGiftModels.count; +} + +- (GiftInfoModel *)giftForIndex:(NSInteger)index { + return [self.selectedGiftModels xpSafeObjectAtIndex:index]; +} + +- (NSInteger)countOfGiftForIndex:(NSInteger)index { + return [[self.selectedGiftCounts xpSafeObjectAtIndex:index] integerValue]; +} + +- (NSArray *)loadConfigWaitingTimes { + return self.infoModel.redEnvelopeV2Config.timeItems; +} + +- (NSArray *)loadConfigWaitingTimesMins { + NSMutableArray *arr = @[].mutableCopy; + for (NSNumber *time in self.infoModel.redEnvelopeV2Config.timeItems) { + [arr addObject:@(time.integerValue/60)]; + } + return arr.copy; +} + +- (NSArray *)loadConfigLuckyBagNumbers { + return self.infoModel.redEnvelopeV2Config.numItems; +} + +- (NSArray *)loadConfigLuckyBagMoneys { + return self.infoModel.redEnvelopeV2Config.goldItems; +} + +- (NSInteger)packageBadgeNum { + return self.packageNum; +} + + @end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.h new file mode 100644 index 00000000..b406aa10 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.h @@ -0,0 +1,18 @@ +// +// LuckyPackageMessageTableViewCell.h +// YuMi +// +// Created by P on 2025/2/14. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface LuckyPackageMessageTableViewCell : UITableViewCell + +@property(nonatomic, copy) NSDictionary *dataSource; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.m new file mode 100644 index 00000000..43109b07 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageMessageTableViewCell.m @@ -0,0 +1,113 @@ +// +// LuckyPackageMessageTableViewCell.m +// YuMi +// +// Created by P on 2025/2/14. +// + +#import "LuckyPackageMessageTableViewCell.h" + +@interface LuckyPackageMessageTableViewCell() + +@property(nonatomic, strong) UIImageView *bgImageView; +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UILabel *nickLabel; +@property(nonatomic, strong) UILabel *contentLabel; + +@end + +@implementation LuckyPackageMessageTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + + self.selectionStyle = UITableViewCellSelectionStyleNone; + + [self.contentView addSubview:self.bgImageView]; + [self.contentView addSubview:self.avatarImageView]; + [self.contentView addSubview:self.nickLabel]; + [self.contentView addSubview:self.contentLabel]; + + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView).insets(UIEdgeInsetsMake(0, 0, 10, 0)); + }]; + + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.mas_equalTo(9); + make.size.mas_equalTo(CGSizeMake(26, 26)); + }]; + + [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.avatarImageView); + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(4); + }]; + + [self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(6); + make.leading.trailing.mas_equalTo(self.contentView).inset(9); + }]; + } + return self; +} + +- (void)setDataSource:(NSDictionary *)dataSource { + _dataSource = dataSource; + + NSString *bgImageName = isMSRTL() ? @"_ar" : @""; + NSString *type = [dataSource objectForKey:@"type"]; + NSString *content = @""; + if ([type isEqualToString:@"GIFT"]) { + bgImageName = [NSString stringWithFormat:@"luck_package_message_gift%@", bgImageName]; + content = YMLocalizedString(@"1.0.37_text_24"); + } else { + bgImageName = [NSString stringWithFormat:@"luck_package_message_coin%@", bgImageName]; + content = YMLocalizedString(@"1.0.37_text_25"); + } + [self.bgImageView setImage:kImage(bgImageName)]; + + NSString *avatarURL = [dataSource objectForKey:@"sendUserAvatar"]; + self.avatarImageView.imageUrl = avatarURL; + + NSString *name = [dataSource objectForKey:@"sendUserNick"]; + self.nickLabel.text = name; + + self.contentLabel.text = content; +} + +- (UIImageView *)bgImageView { + if (!_bgImageView) { + _bgImageView = [[UIImageView alloc] init]; + } + return _bgImageView; +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeCornerAvatar; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.backgroundColor = [UIColor clearColor]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setAllCornerRadius:13 borderWidth:1 borderColor:UIColorFromRGB(0xFFEA5C)]; + } + return _avatarImageView; +} + +- (UILabel *)nickLabel { + if (!_nickLabel) { + _nickLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0xffea5c)]; + } + return _nickLabel; +} + +- (UILabel *)contentLabel { + if (!_contentLabel) { + _contentLabel = [UILabel labelInitWithText:@"" font:kFontMedium(13) textColor:UIColorFromRGB(0xffea5c)]; + _contentLabel.numberOfLines = 0; + } + return _contentLabel; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.h index 0dbc25ba..f9a930b0 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.h +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.h @@ -6,10 +6,45 @@ // #import "BaseMvpPresenter.h" +#import "GiftInfoModel.h" +#import "WalletInfoModel.h" +#import "RoomLuckyPackageInfoModel.h" NS_ASSUME_NONNULL_BEGIN +@protocol LuckyPackagePresenterProtocol + +- (void)loadGiftsSuccess:(NSArray *)gifts; +- (void)loadWalletInfoSuccess:(WalletInfoModel *)walletInfo; + +@end + @interface LuckyPackagePresenter : BaseMvpPresenter +- (void)resetGiftsCount:(NSString *)roomUid; +- (void)loadGifts:(NSString *)roomUid; + +- (void)loadWalletInfo; + +- (void)sendGiftLuckyPackage:(NSInteger)roomUid + uid:(NSString *)uid + waitingTime:(NSInteger)time + selectedGifts:(NSArray *)gifts + success:(void(^)(void))success; + +- (void)sendCoinLuckyPackage:(NSInteger)roomUid + uid:(NSString *)uid + waitingTime:(NSInteger)time + num:(NSNumber *)num + goldNum:(NSNumber *)goldNum + success:(void(^)(void))success; + +- (void)loadRoomLuckyPackageInfo:(NSInteger)roomUid success:(void(^)(RoomLuckyPackageInfoModel *model))success; + +- (void)loadLuckyPackageRecords:(NSInteger)page type:(NSInteger)type success:(void(^)(NSArray *array))success; + +- (void)open:(NSInteger)packageId success:(void(^)(OpenRedEnvelopeVo *model))success failure:(void(^)(NSError *error))failure; + +- (void)loadReceiversOfLuckyPackage:(NSInteger)luckyPackageID success:(void(^)(NSArray *array))success failure:(void(^)(NSError *error))failure; @end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.m index e700a944..430a2abe 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.m +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackagePresenter.m @@ -7,6 +7,138 @@ #import "LuckyPackagePresenter.h" +#import "Api.h" +#import "Api+LuckyPackage.h" +#import "XPGiftStorage.h" +#import "LuckyPackageLogicManager.h" + @implementation LuckyPackagePresenter +- (void)resetGiftsCount:(NSString *)roomUid { + NSArray *array = [[XPGiftStorage shareStorage] getGiftPanelTagsDatasource:roomUid]; + if (array.count > 0) { + GiftPanelTabModel *firstTab = array.firstObject; + NSArray *arr = firstTab.gifts; + for (GiftInfoModel *gift in arr) { + gift.luckyPackageCount = 0; + } + } +} + +- (void)loadGifts:(NSString *)roomUid { + NSArray *array = [[XPGiftStorage shareStorage] getGiftPanelTagsDatasource:roomUid]; + if (array.count > 0) { + GiftPanelTabModel *firstTab = array.firstObject; + NSArray *arr = firstTab.gifts; + [[self getView] loadGiftsSuccess:arr]; + } +} + + +- (void)loadWalletInfo { + NSString * uid = [AccountInfoStorage instance].getUid; + NSString * ticket = [AccountInfoStorage instance].getTicket; + @kWeakify(self); + [Api getUserWalletInfo:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); + WalletInfoModel * model = [WalletInfoModel modelWithDictionary:data.data]; + [[self getView] loadWalletInfoSuccess:model]; + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:NO] uid:uid ticket:ticket]; +} + +- (void)sendGiftLuckyPackage:(NSInteger)roomUid + uid:(NSString *)uid + waitingTime:(NSInteger)time + selectedGifts:(NSArray *)gifts + success:(void(^)(void))success{ + NSMutableArray *giftItems = @[].mutableCopy; + for (GiftInfoModel *model in gifts) { + [giftItems addObject:@{@"giftId":@(model.giftId), + @"giftNum":@(model.luckyPackageCount)}]; + } + + [Api postGiftNewRedEnvelope:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success(); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:YES errorToast:YES] + countDownSecond:@(time) + giftItems:giftItems.copy + roomUid:@(roomUid) + uid:uid + type:@"GIFT"]; +} + +- (void)sendCoinLuckyPackage:(NSInteger)roomUid + uid:(NSString *)uid + waitingTime:(NSInteger)time + num:(NSNumber *)num + goldNum:(NSNumber *)goldNum + success:(void(^)(void))success { + [Api postDiamondNewRedEnvelope:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success(); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:YES errorToast:YES] + countDownSecond:@(time) + goldNum:goldNum + num:num + roomUid:@(roomUid) + uid:uid + type:@"DIAMOND"]; +} + +- (void)loadRoomLuckyPackageInfo:(NSInteger)roomUid success:(void(^)(RoomLuckyPackageInfoModel *model))success { + [Api getNewRedEnvelopeList:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success([RoomLuckyPackageInfoModel modelWithJSON:data.data]); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:NO errorToast:NO] roomUid:@(roomUid)]; +} + +- (void)loadLuckyPackageRecords:(NSInteger)page type:(NSInteger)type success:(void(^)(NSArray *array))success { + [Api getNewRedEnvelopeDetail:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success([RedEnvelopeListVo modelsWithArray:data.data]); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + + } showLoading:NO errorToast:YES] + pageNo:@(page) + pageSize:@(100) + type:@(type)]; +} + +- (void)open:(NSInteger)packageId success:(void(^)(OpenRedEnvelopeVo *model))success failure:(void(^)(NSError *error))failure { + [Api postNewRedEnvelopeOpen:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success([OpenRedEnvelopeVo modelWithJSON:data.data]); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + if (failure) { + failure([NSError errorWithDomain:msg code:code userInfo:nil]); + } + } showLoading:NO errorToast:NO] redEnvelopeId:@(packageId)]; +} + +- (void)loadReceiversOfLuckyPackage:(NSInteger)luckyPackageID success:(void(^)(NSArray *array))success failure:(void(^)(NSError *error))failure { + [Api getNewRedEnvelopeGet:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + if (success) { + success([RedEnvelopeReceiveVo modelsWithArray:data.data]); + } + } fail:^(NSInteger code, NSString * _Nullable msg) { + if (failure) { + failure([NSError errorWithDomain:msg code:code userInfo:nil]); + } + } showLoading:YES errorToast:YES] redEnvelopeId:@(luckyPackageID)]; +} + @end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.h new file mode 100644 index 00000000..ead49230 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.h @@ -0,0 +1,20 @@ +// +// LuckyPackageStatusView.h +// YuMi +// +// Created by P on 2025/2/12. +// + +#import +@class RedEnvelopeListVo; + +NS_ASSUME_NONNULL_BEGIN + +@interface LuckyPackageStatusView : UIView + + +- (instancetype)initWithModel:(RedEnvelopeListVo *)model gap:(NSInteger)gap; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.m new file mode 100644 index 00000000..22aad9a5 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageStatusView.m @@ -0,0 +1,886 @@ +// +// LuckyPackageStatusView.m +// YuMi +// +// Created by P on 2025/2/12. +// + +#import "LuckyPackageStatusView.h" + +#import "LuckyPackageLogicManager.h" +#import "RoomLuckyPackageInfoModel.h" +#import "UserInfoModel.h" +#import "XPSkillCardPlayerManager.h" +#import +#import "XPRoomGiftAnimationParser.h" +#import "MoliMoneyLabel.h" + +@interface LuckyPackageOtherListTableViewCell: UITableViewCell + +@property(nonatomic, strong) RedEnvelopeReceiveVo *cellModel; +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UIView *meBackgroundView; +@property(nonatomic, strong) UILabel *meLabel; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *dateLabel; +@property(nonatomic, strong) MoliMoneyLabel *moneyLabel; +//@property(nonatomic, strong) UILabel *dateilLabel; +//@property(nonatomic, strong) UIImageView *moneyIcon; + + +@end + +@implementation LuckyPackageOtherListTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + + [self.contentView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.contentView); + make.leading.mas_equalTo(0); + make.size.mas_equalTo(45); + }]; + + [self.contentView addSubview:self.meBackgroundView]; + [self.contentView addSubview:self.meLabel]; + [self.meLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.avatarImageView); + make.centerY.mas_equalTo(self.avatarImageView.mas_bottom).offset(-4); + make.height.mas_equalTo(14); + make.width.mas_equalTo(28); + }]; + + [self.meBackgroundView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.meLabel); + }]; + + [self.contentView addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(7);; + make.top.mas_equalTo(self.avatarImageView).offset(2); + }]; + + // TODO: 改造为 moli money label + [self.contentView addSubview:self.moneyLabel]; + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.titleLabel); + }]; +// UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[ +// self.dateilLabel, +// self.moneyIcon +// ]]; +// stack.spacing = 0; +// [self.contentView addSubview:stack]; +// [stack mas_makeConstraints:^(MASConstraintMaker *make) { + +// }]; +// +// [self.dateilLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.height.mas_equalTo(16); +//// make.width.mas_greaterThanOrEqualTo(22); +// }]; +// [self.moneyIcon mas_makeConstraints:^(MASConstraintMaker *make) { +// make.size.mas_equalTo(CGSizeMake(16, 16)); +// }]; + + [self.contentView addSubview:self.dateLabel]; + [self.dateLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.avatarImageView.mas_trailing).offset(7); + make.trailing.mas_equalTo(self.contentView).offset(-8); + make.bottom.mas_equalTo(self.avatarImageView).offset(-4); + }]; + } + return self; +} + +- (void)setCellModel:(RedEnvelopeReceiveVo *)cellModel { + _cellModel = cellModel; + self.avatarImageView.imageUrl = cellModel.userVO.avatar; + self.titleLabel.text = cellModel.userVO.nick; + self.dateLabel.text = cellModel.createTimeStr; + self.meLabel.hidden = !cellModel.isME; + self.meBackgroundView.hidden = !cellModel.isME; + + RedEnvelopeGiftItemVO *giftItem = [cellModel.redEnvelopeGiftItemVOs xpSafeObjectAtIndex:0]; + if (giftItem) { + [self.moneyLabel displayIcon:NO]; + [self.moneyLabel updateContent:[NSString stringWithFormat:@"%@*%@", giftItem.giftVo.giftName, @(giftItem.giftNum)]]; + } else { + [self.moneyLabel displayIcon:YES]; + [self.moneyLabel updateContent:@(cellModel.amount).stringValue]; + } +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeCornerAvatar; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.backgroundColor = [UIColor clearColor]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setAllCornerRadius:45/2 borderWidth:2 borderColor:UIColorFromRGB(0xffd168)]; + } + return _avatarImageView; +} + +- (UIView *)meBackgroundView { + if (!_meBackgroundView) { + _meBackgroundView = [[UIView alloc]init]; + [_meBackgroundView addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xFFDC8B), + UIColorFromRGB(0xFBCC5F) + ] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) cornerRadius:7]; + } + return _meBackgroundView; +} + +- (UILabel *)meLabel { + if (!_meLabel) { + _meLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_22") font:kFontMedium(11) textColor:UIColorFromRGB(0x292601)]; + _meLabel.textAlignment = NSTextAlignmentCenter; + _meLabel.backgroundColor = [UIColor clearColor]; + } + return _meLabel; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0x292601)]; + } + return _titleLabel; +} + +- (UILabel *)dateLabel { + if (!_dateLabel) { + _dateLabel = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0x292601)]; + _dateLabel.alpha = 0.8; + } + return _dateLabel; +} + +- (MoliMoneyLabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0x292601) font:kFontMedium(14) moneyPostion:2 moneySize:CGSizeMake(16, 16)]; + [_moneyLabel updateSpacing:0]; + } + return _moneyLabel; +} + +@end + +@interface LuckyPackageStatusView () + +@property(nonatomic, strong) RedEnvelopeListVo *model; +@property(nonatomic, strong) OpenRedEnvelopeVo *openModel; +@property(nonatomic, strong) NSArray *receiveVoArray; + +@property(nonatomic, strong) UIImageView *bgShortImageView; +@property(nonatomic, strong) UIImageView *bgLongImageView; +@property(nonatomic, strong) UIImageView *centerIconImageView; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *subTitleLabel; +@property(nonatomic, strong) UILabel *counterLabel; +@property(nonatomic, strong) UILabel *giftNumLabel; +@property(nonatomic, strong) UIView *giftNumBGView; +@property(nonatomic, strong) UILabel *tipsLabel; +@property(nonatomic, strong) MoliMoneyLabel *giftCoinLabel; +@property(nonatomic, strong) UIButton *viewOthersButton; +@property(nonatomic, strong) UIButton *okButton; +@property(nonatomic, strong) UIView *giftImageBGView; +@property(nonatomic, strong) NetImageView *giftImageView; +@property(nonatomic, strong) UILabel *giftNameLabel; +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UITableView *tableView; +@property(nonatomic, strong) UILabel *moneyLabel; +@property(nonatomic, strong) UIImageView *moneyIcon; +@property(nonatomic, strong) UIImageView *emptyImageView; +@property(nonatomic, assign) NSInteger gap; +@property(nonatomic, strong) NSTimer *timer; + +@property(nonatomic, strong) VAPView *mp4View; +@property(nonatomic, strong) XPRoomGiftAnimationParser *mp4Parser; + +@end + +@implementation LuckyPackageStatusView + +- (instancetype)initWithModel:(RedEnvelopeListVo *)model gap:(NSInteger)gap { + if (self = [super init]) { + self.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight); + self.userInteractionEnabled = YES; + self.backgroundColor = [UIColor clearColor]; + + UIButton *exit = [UIButton buttonWithType:UIButtonTypeCustom]; + exit.frame = self.bounds; + [self addSubview:exit]; + [exit addTarget:self action:@selector(exitView) forControlEvents:UIControlEventTouchUpInside]; + + self.gap = gap; + self.model = model; + } + return self; +} + +- (void)updateUserInfo:(UserInfoModel *)userInfo { + +} + +- (void)exitView { + [TTPopup dismiss]; +} + +- (void)setModel:(RedEnvelopeListVo *)model { + _model = model; + + [self setupUIForReadyOpen]; +} + +#pragma mark - +- (void)setupUIForReadyOpen { + [self addSubview:self.bgShortImageView]; + [self.bgShortImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self); + make.height.mas_equalTo(338); +// make.height.mas_equalTo(kGetScaleWidth(338)); + make.width.mas_equalTo(KScreenWidth - 37*2); + }]; + + [self addSubview:self.centerIconImageView]; + [self.centerIconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.bgShortImageView).offset(77); + make.size.mas_equalTo(CGSizeMake(123,123)); + make.centerX.mas_equalTo(self.bgShortImageView); + }]; + + [self addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.centerY.mas_equalTo(self.bgShortImageView.mas_top); + make.size.mas_equalTo(CGSizeMake(77, 77)); + }]; + + [self addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(8); + }]; + + [self addSubview:self.subTitleLabel]; + [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(2); + }]; + + [self addSubview:self.okButton]; + [self.okButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self.bgShortImageView).offset(-19); + make.size.mas_equalTo(CGSizeMake(190, 47)); + }]; + + [self addSubview:self.giftImageBGView]; + [self addSubview:self.giftImageView]; + [self.giftImageBGView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom); + make.centerX.mas_equalTo(self); + make.size.mas_equalTo(CGSizeMake(98, 98)); + }]; + [self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.giftImageBGView); + make.size.mas_equalTo(CGSizeMake(90, 90)); + }]; + + [self.giftImageView addSubview:self.giftNumBGView]; + [self.giftImageView addSubview:self.giftNumLabel]; + [self.giftNumBGView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.trailing.mas_equalTo(self.giftImageBGView); + make.height.mas_equalTo(18); + make.width.mas_equalTo(30); + }]; + [self.giftNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.giftNumBGView); + make.height.mas_equalTo(18); + }]; + + + [self addSubview:self.giftNameLabel]; + [self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgShortImageView); + make.top.mas_equalTo(self.giftImageBGView.mas_bottom).offset(8); + }]; + + + [self addSubview:self.giftCoinLabel]; + [self addSubview:self.tipsLabel]; + [self addSubview:self.viewOthersButton]; + + [self.giftCoinLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgShortImageView); + make.top.mas_equalTo(self.giftNameLabel.mas_bottom); + make.height.mas_equalTo(16); + }]; + + UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.moneyLabel, + self.moneyIcon + ]]; + stack.spacing = 7; + [self addSubview:stack]; + [stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgShortImageView); + make.height.mas_equalTo(30); + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(55); + }]; + [self.moneyIcon mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(30, 30)); + }]; + + NSTimeZone *gmt8TimeZone = [NSTimeZone timeZoneForSecondsFromGMT:8 * 3600]; + NSCalendar *calendar = [NSCalendar currentCalendar]; + calendar.timeZone = gmt8TimeZone; + NSDateComponents *components = [calendar componentsInTimeZone:gmt8TimeZone fromDate:[NSDate date]]; + NSDate *gmt8Date = [calendar dateFromComponents:components]; + NSTimeInterval local = [gmt8Date timeIntervalSince1970]; + self.gap = (self.model.beginTime - local * 1000)/1000; + + if (self.gap > 0) { + [self updateUIForCounting]; + } else { + [self updateUIForReadyOpen]; + } +} + +- (void)updateUIForCounting { + self.counterLabel.hidden = NO; + self.centerIconImageView.hidden = NO; + + self.giftNumLabel.hidden = YES; + self.giftNumBGView.hidden = YES; + self.giftImageView.hidden = YES; + self.giftImageBGView.hidden = YES; + self.giftNameLabel.hidden = YES; + self.viewOthersButton.hidden = YES; + self.moneyIcon.hidden = YES; + self.moneyLabel.hidden = YES; + + [self addSubview:self.counterLabel]; + [self.counterLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.centerIconImageView.mas_bottom); + }]; + + self.avatarImageView.imageUrl = self.model.avatar; + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_18"); + [self.okButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal]; + + if ([self.model.type isEqualToString:@"GIFT"]) { + self.titleLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_17.1"), self.model.nick]; + self.centerIconImageView.image = kImage(@"luck_package_entrance_gift"); + } else { + self.titleLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_17.2"), self.model.nick]; + self.centerIconImageView.image = kImage(@"luck_package_entrance_coin"); + } + + [self startTimer]; +} + +- (void)updateUIForReadyOpen { + self.centerIconImageView.hidden = NO; + + self.subTitleLabel.hidden = YES; + self.counterLabel.hidden = YES; + self.giftNumLabel.hidden = YES; + self.giftNumBGView.hidden = YES; + self.giftImageView.hidden = YES; + self.giftImageBGView.hidden = YES; + self.giftNameLabel.hidden = YES; + self.viewOthersButton.hidden = YES; + self.moneyIcon.hidden = YES; + self.moneyLabel.hidden = YES; + + self.avatarImageView.imageUrl = self.model.avatar; + [self.okButton setTitle:YMLocalizedString(@"1.0.37_text_20") forState:UIControlStateNormal]; + + if ([self.model.type isEqualToString:@"GIFT"]) { + self.titleLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_17.1"), self.model.nick]; + self.centerIconImageView.image = kImage(@"luck_package_entrance_gift"); + } else { + self.titleLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_17.2"), self.model.nick]; + self.centerIconImageView.image = kImage(@"luck_package_entrance_coin"); + } +} + +- (void)updateUIForAlreadyGet { + self.centerIconImageView.hidden = YES; + self.viewOthersButton.hidden = NO; + + OpenRedEnvelopeCurrentUserGift *receivedGift = [self.openModel.currentUserGifts xpSafeObjectAtIndex:0]; + if (receivedGift) { + self.tipsLabel.text = YMLocalizedString(@"1.0.37_text_51"); + [self.tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.giftCoinLabel.mas_bottom); + make.height.mas_equalTo(20); + }]; + [self.viewOthersButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgShortImageView); + make.top.mas_equalTo(self.tipsLabel.mas_bottom); + make.height.mas_equalTo(10); + }]; + + self.giftCoinLabel.hidden = NO; + self.giftNumLabel.hidden = NO; + self.giftNumBGView.hidden = NO; + self.giftImageBGView.hidden = NO; + self.giftImageView.hidden = NO; + self.giftNameLabel.hidden = NO; + self.giftNumLabel.text = [NSString stringWithFormat:@" x%@ ", @(receivedGift.giftNum)]; + self.giftImageView.imageUrl = receivedGift.giftVo.giftUrl; + self.giftNameLabel.text = receivedGift.giftVo.giftName; + [self.giftCoinLabel updateContent:@(receivedGift.giftVo.goldPrice).stringValue]; + } else { + self.tipsLabel.text = YMLocalizedString(@"1.0.37_text_50"); + [self.tipsLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.moneyIcon.mas_bottom).offset(25); + make.height.mas_equalTo(20); + }]; + [self.viewOthersButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgShortImageView); + make.top.mas_equalTo(self.tipsLabel.mas_bottom).offset(20); + }]; + + self.moneyIcon.hidden = NO; + self.moneyLabel.hidden = NO; + self.moneyLabel.text = @(self.openModel.currentUserAmount).stringValue; + } + + [self.okButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal]; +} + +- (void)updateUIForEmptyBag { + self.centerIconImageView.hidden = YES; + self.viewOthersButton.hidden = NO; + self.subTitleLabel.hidden = NO; + self.giftImageBGView.hidden = YES; + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_21"); + [self.okButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal]; + + [self addSubview:self.emptyImageView]; + [self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.subTitleLabel.mas_bottom); + make.size.mas_equalTo(self.giftImageBGView).multipliedBy(1.5); + }]; +} + +- (void)startTimer { + [self stopTimer]; + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(timerTick) + userInfo:nil + repeats:YES]; +} + +- (void)stopTimer { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + } +} + +- (void)timerTick { + self.gap--; + [self updateLabel]; + + if (self.gap <= 0) { + [self stopTimer]; + self.counterLabel.hidden = YES; + } +} + +- (void)updateLabel { + NSInteger hours = self.gap / 3600; + NSInteger minutes = (self.gap % 3600)/60; + NSInteger second = self.gap % 60; + if (hours > 0) { + self.counterLabel.text = [NSString stringWithFormat:@" %02ld:%02ld ", (long)hours, (long)minutes]; + } else { + self.counterLabel.text = [NSString stringWithFormat:@" %02ld:%02ld ", (long)minutes, (long)second]; + } +} + +- (void)displayOthersList { + [self.giftImageBGView removeFromSuperview]; + [self.giftNumLabel removeFromSuperview]; + [self.giftImageView removeFromSuperview]; + + [self addSubview:self.bgLongImageView]; + [self.bgLongImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self); + make.height.mas_equalTo(414); + make.width.mas_equalTo(KScreenWidth - 37*2); + }]; + + [self.avatarImageView removeFromSuperview]; + [self.bgLongImageView addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.bgLongImageView); + make.centerY.mas_equalTo(self.bgLongImageView.mas_top); + make.size.mas_equalTo(CGSizeMake(77, 77)); + }]; + + [self.titleLabel removeFromSuperview]; + [self.bgLongImageView addSubview:self.titleLabel]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.bgLongImageView).offset(49); + }]; + + [self.subTitleLabel removeFromSuperview]; + [self.bgLongImageView addSubview:self.subTitleLabel]; + [self.subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self.bgLongImageView).offset(-63); + }]; + self.subTitleLabel.text = YMLocalizedString(@"1.0.37_text_23"); + self.subTitleLabel.textColor = [UIColor whiteColor]; + + [self.okButton removeFromSuperview]; + [self.bgLongImageView addSubview:self.okButton]; + [self.okButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self.bgLongImageView).offset(-9); + make.size.mas_equalTo(CGSizeMake(190, 47)); + }]; + + [self.bgLongImageView addSubview:self.tableView]; + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(4); + make.bottom.mas_equalTo(self.subTitleLabel.mas_top).offset(-30); + make.leading.trailing.mas_equalTo(self.bgLongImageView).inset(40); + }]; + + [self.tableView reloadData]; +} + +#pragma mark - +- (void)didTapViewOthers { + [XNDJTDDLoadingTool showLoading]; + @kWeakify(self); + NSInteger packageID = self.openModel.redEnvelopeVO.redEnvelopeId; + if (packageID == 0) { + packageID = [self.openModel.redEnvelopeVO.id integerValue]; + } + + [[LuckyPackageLogicManager sharedInstance] requestLuckyPackageReceiversAPI:packageID + success:^(NSArray *array) { + @kStrongify(self); + [XNDJTDDLoadingTool hideHUD]; + for (RedEnvelopeReceiveVo *vo in array) { + if (vo.userVO.uid == [[AccountInfoStorage instance] getUid].integerValue) { + vo.isME = YES; + } + } + self.receiveVoArray = array; + [self displayOthersList]; + } failure:^(NSError * _Nonnull error) { + [XNDJTDDLoadingTool showErrorWithMessage:error.domain]; + }]; +} + +- (void)didTapOK { + if ([self.okButton.titleLabel.text isEqualToString:YMLocalizedString(@"TTAlertConfig0")]) { + [TTPopup dismiss]; + } else { + + [XNDJTDDLoadingTool showLoading]; + NSInteger packageID = self.model.redEnvelopeId; + if (packageID == 0) { + packageID = [self.model.id integerValue]; + } + @kWeakify(self); + [[LuckyPackageLogicManager sharedInstance] requestOpenLockyPackageAPI:packageID success:^(OpenRedEnvelopeVo * _Nonnull model) { + [XNDJTDDLoadingTool hideHUD]; + @kStrongify(self); + self.openModel = model; + switch (model.redEnvelopeState) { + case 3: + [self updateUIForEmptyBag]; + [[LuckyPackageLogicManager sharedInstance] removeReceivedLuckyPackage]; + break; + case 4: + [self playOpenAnimation]; + [[LuckyPackageLogicManager sharedInstance] removeReceivedLuckyPackage]; + break; + case 7: + [self updateUIForAlreadyGet]; + [[LuckyPackageLogicManager sharedInstance] removeReceivedLuckyPackage]; + break; + + default: + [TTPopup dismiss]; + break; + } + } failure:^(NSError * _Nonnull error) { + [XNDJTDDLoadingTool showErrorWithMessage:error.domain]; + }]; + } +} + +- (void)playOpenAnimation { + NSString *fileName = @"coincoin"; + if ([self.model.type isEqualToString:@"GIFT"]) { + fileName = @"giftgift"; + } + if (!_mp4View) { + _mp4View = [[VAPView alloc] init]; + [self addSubview:_mp4View]; + [self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(self.centerIconImageView).multipliedBy(3); + make.center.mas_equalTo(self.centerIconImageView); + }]; + [self layoutIfNeeded]; + } else { + _mp4View.hidden = NO; + } + + NSString *filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"mp4"]; + [self.mp4View playHWDMP4:filePath repeatCount:10 delegate:self]; +} + +#pragma mark - HWDMP4PlayDelegate +- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config { + dispatch_async(dispatch_get_main_queue(), ^{ + self.centerIconImageView.hidden = YES; + }); + return YES; +} + +- (void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container { + @kWeakify(self); + dispatch_async(dispatch_get_main_queue(), ^{ + container.hidden = YES; + [container removeFromSuperview]; + @kStrongify(self); + [self updateUIForAlreadyGet]; + }); +} + +- (void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container { + @kWeakify(self); + dispatch_async(dispatch_get_main_queue(), ^{ + container.hidden = YES; + [container removeFromSuperview]; + @kStrongify(self); + [self updateUIForAlreadyGet]; + }); +} + +- (void)viewDidFailPlayMP4:(NSError *)error { + NSLog(@"%@", error); +} + +#pragma mark - +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.receiveVoArray.count; +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 61; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + LuckyPackageOtherListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LuckyPackageOtherListTableViewCell" forIndexPath:indexPath]; + cell.cellModel = [self.receiveVoArray xpSafeObjectAtIndex:indexPath.row]; + return cell; +} + +#pragma mark - +- (UIImageView *)bgShortImageView { + if (!_bgShortImageView) { + _bgShortImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_bg_short")]; + _bgShortImageView.userInteractionEnabled = YES; + } + return _bgShortImageView; +} + +- (UIImageView *)bgLongImageView { + if (!_bgLongImageView) { + _bgLongImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_bg_long")]; + _bgLongImageView.userInteractionEnabled = YES; + } + return _bgLongImageView; +} + +- (UIImageView *)centerIconImageView { + if (!_centerIconImageView) { + _centerIconImageView = [[UIImageView alloc] init]; + _centerIconImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _centerIconImageView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_17.1") font:kFontSemibold(15) textColor:UIColorFromRGB(0x292601)]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + } + return _titleLabel; +} + +- (UILabel *)subTitleLabel { + if (!_subTitleLabel) { + _subTitleLabel = [UILabel labelInitWithText:YMLocalizedString(@"1.0.37_text_18") font:kFontRegular(12) textColor:UIColorRGBAlpha(0x292601, 0.8)]; + _subTitleLabel.textAlignment = NSTextAlignmentCenter; + } + return _subTitleLabel; +} + +- (UILabel *)counterLabel { + if (!_counterLabel) { + _counterLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(20) textColor:UIColorFromRGB(0x292601)]; + _counterLabel.textAlignment = NSTextAlignmentCenter; + } + return _counterLabel; +} + +- (UILabel *)tipsLabel { + if (!_tipsLabel) { + _tipsLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:UIColorFromRGB(0x292601)]; + _tipsLabel.textAlignment = NSTextAlignmentCenter; + } + return _tipsLabel; +} + +- (UIView *)giftNumBGView { + if (!_giftNumBGView) { + _giftNumBGView = [[UIView alloc] init]; + [_giftNumBGView addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xfff437), + UIColorFromRGB(0xff9f00) + ] startPoint:CGPointMake(0.5, 0) endPoint:CGPointMake(0.5, 1) cornerRadius:9]; + [_giftNumBGView setAllCornerRadius:9 borderWidth:1 borderColor:UIColorFromRGB(0x9f6f41)]; + } + return _giftNumBGView; +} + +- (UILabel *)giftNumLabel { + if (!_giftNumLabel) { + _giftNumLabel = [UILabel labelInitWithText:@" x1 " font:kFontMedium(13) textColor:UIColorFromRGB(0x292601)]; + _giftNumLabel.textAlignment = NSTextAlignmentCenter; + } + return _giftNumLabel; +} + +- (UILabel *)giftNameLabel { + if (!_giftNameLabel) { + _giftNameLabel = [UILabel labelInitWithText:@"" font:kFontMedium(16) textColor:UIColorFromRGB(0x292601)]; + _giftNameLabel.textAlignment = NSTextAlignmentCenter; + } + return _giftNameLabel; +} + +- (UIButton *)viewOthersButton { + if (!_viewOthersButton) { + _viewOthersButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_viewOthersButton.titleLabel setFont:kFontSemibold(12)]; + [_viewOthersButton setTitle:YMLocalizedString(@"1.0.37_text_19") forState:UIControlStateNormal]; + [_viewOthersButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateNormal]; + [_viewOthersButton addTarget:self action:@selector(didTapViewOthers) forControlEvents:UIControlEventTouchUpInside]; + } + return _viewOthersButton; +} + +- (UIButton *)okButton { + if (!_okButton) { + _okButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_okButton setBackgroundImage:kImage(@"luck_package_send_bg") forState:UIControlStateNormal]; + [_okButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateNormal]; + [_okButton.titleLabel setFont:kFontSemibold(15)]; + [_okButton addTarget:self action:@selector(didTapOK) forControlEvents:UIControlEventTouchUpInside]; + } + return _okButton; +} + +- (UIView *)giftImageBGView { + if (!_giftImageBGView) { + _giftImageBGView = [[UIView alloc] init]; + [_giftImageBGView setBackgroundColor:UIColorFromRGB(0xf5d2b1)]; + [_giftImageBGView setAllCornerRadius:12 borderWidth:1 borderColor:UIColorFromRGB(0x9f6f41)]; + } + return _giftImageBGView; +} + +- (NetImageView *)giftImageView { + if (!_giftImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeCornerAvatar; + _giftImageView = [[NetImageView alloc] initWithConfig:config]; + _giftImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _giftImageView; +} + +- (UIImageView *)emptyImageView { + if (!_emptyImageView) { + _emptyImageView = [[UIImageView alloc] initWithImage:kImage(@"缺省")]; + } + return _emptyImageView; +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + config.imageType = ImageTypeCornerAvatar; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.backgroundColor = [UIColor clearColor]; + _avatarImageView.contentMode = UIViewContentModeScaleAspectFill; + [_avatarImageView setAllCornerRadius:77/2 borderWidth:2 borderColor:UIColorFromRGB(0xffd168)]; + } + return _avatarImageView; +} + +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.dataSource = self; + _tableView.delegate = self; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.separatorInset = UIEdgeInsetsZero; + _tableView.separatorColor = UIColorFromRGB(0xEDC59F); + [_tableView registerClass:[LuckyPackageOtherListTableViewCell class] forCellReuseIdentifier:@"LuckyPackageOtherListTableViewCell"]; + } + return _tableView; +} + +- (UILabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [UILabel labelInitWithText:@"0" font:kFontMedium(30) textColor:UIColorFromRGB(0x292601)]; + } + return _moneyLabel; +} + +- (UIImageView *)moneyIcon { + if (!_moneyIcon) { + _moneyIcon = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + } + return _moneyIcon; +} + +- (MoliMoneyLabel *)giftCoinLabel { + if (!_giftCoinLabel) { + _giftCoinLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0x292601) font:kFontRegular(13) moneyPostion:1 moneySize:CGSizeMake(16, 16)]; + _giftCoinLabel.hidden = YES; + } + return _giftCoinLabel; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.h b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.h index a313ac96..29558679 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.h +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.h @@ -6,11 +6,16 @@ // #import "MvpViewController.h" +#import "RoomHostDelegate.h" NS_ASSUME_NONNULL_BEGIN @interface LuckyPackageViewController : MvpViewController +- (instancetype)initWithdelegate:(id)delegate; + +@property(nonatomic, copy) void(^close)(void); + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.m b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.m index 775d529e..7f217a9a 100644 --- a/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.m +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/LuckyPackageViewController.m @@ -7,25 +7,2332 @@ #import "LuckyPackageViewController.h" -@interface LuckyPackageViewController () +#import "MoliMoneyLabel.h" +#import "EmptyDataView.h" +#import "NSDate+DateUtils.h" +#import "RoomInfoModel.h" +#import "UserInfoModel.h" +#import "LuckyPackagePresenter.h" +#import "XPIAPRechargeViewController.h" +#import "XCCurrentVCStackManager.h" +#import "LuckyPackageLogicManager.h" +#import "LuckyPackageBannerView.h" +#import "XPWebViewController.h" +#import "XPGiftCollectionViewFlowLayout.h" + +@interface LuckyPackageRuleView : UIView + +@property(nonatomic, assign) UIButton *backButton; +@property(nonatomic, strong) XPWebViewController *webView; + +@end + +@implementation LuckyPackageRuleView + + + +@end + +@interface LuckyPackageRecordsCell : UITableViewCell + +@property(nonatomic, strong) RedEnvelopeListVo *cellModel; +@property(nonatomic, assign) NSInteger type; +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UILabel *timeLabel; +@property(nonatomic, strong) UILabel *moneyLabel; +@property(nonatomic, strong) UILabel *giftNumLabel; +@property(nonatomic, strong) UIImageView *moneyImageView; + +@end + +@implementation LuckyPackageRecordsCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.backgroundColor = [UIColor clearColor]; + self.contentView.backgroundColor = [UIColor clearColor]; + + [self.contentView addSubview:self.timeLabel]; + [self.contentView addSubview:self.titleLabel]; + [self.contentView addSubview:self.moneyLabel]; + [self.contentView addSubview:self.giftNumLabel]; + [self.contentView addSubview:self.moneyImageView]; + + [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.contentView); + make.bottom.mas_equalTo(self.contentView).offset(-12); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.contentView).offset(8); + }]; + + [self.moneyImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.centerY.mas_equalTo(self.contentView); + make.size.mas_equalTo(CGSizeMake(17, 17)); + }]; + + [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.mas_equalTo(self.moneyImageView.mas_leading).offset(-4); + make.centerY.mas_equalTo(self.moneyImageView); + }]; + + [self.giftNumLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.trailing.centerY.mas_equalTo(self.contentView); + }]; + } + return self; +} + +- (void)setCellModel:(RedEnvelopeListVo *)cellModel { + _cellModel = cellModel; + + if (self.type == 1) { + self.timeLabel.text = [[NSDate dateWithTimeIntervalSince1970:cellModel.beginTime/1000] stringForYearMonthDayDashed]; + } else { + self.timeLabel.text = [[NSDate dateWithTimeIntervalSince1970:cellModel.createTime/1000] stringForYearMonthDayDashed]; + } + + if ([cellModel.type isEqualToString:@"DIAMOND"]) { + self.giftNumLabel.hidden = YES; + self.moneyLabel.hidden = NO; + self.moneyImageView.hidden = NO; + self.moneyLabel.text = @(cellModel.originalAmount).stringValue; + if (self.type == 1) { + self.titleLabel.text = YMLocalizedString(@"1.0.37_text_2"); + } else { + self.titleLabel.text = cellModel.nick; + } + } else if ([cellModel.type isEqualToString:@"GIFT"]) { + self.giftNumLabel.hidden = NO; + self.moneyLabel.hidden = YES; + self.moneyImageView.hidden = YES; + + if (self.type == 1) { + self.titleLabel.text = YMLocalizedString(@"1.0.37_text_1"); + self.giftNumLabel.text = [NSString stringWithFormat:@"%@*%@", YMLocalizedString(@"1.0.37_text_10"), @(cellModel.num)]; + } else { + self.titleLabel.text = cellModel.nick; + self.giftNumLabel.text = [NSString stringWithFormat:@"%@*%@", cellModel.giftName, @(cellModel.originalAmount)]; + } + } +} + +#pragma mark - +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0xffea5c)]; + } + return _titleLabel; +} + +- (UILabel *)timeLabel { + if (!_timeLabel) { + _timeLabel = [UILabel labelInitWithText:@"" font:kFontMedium(12) textColor:UIColorFromRGB(0xffea5c)]; + _timeLabel.alpha = 0.6; + } + return _timeLabel; +} + +- (UILabel *)moneyLabel { + if (!_moneyLabel) { + _moneyLabel = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0xffea5c)]; + } + return _moneyLabel; +} + +- (UILabel *)giftNumLabel { + if (!_giftNumLabel) { + _giftNumLabel = [UILabel labelInitWithText:@"" font:kFontMedium(15) textColor:UIColorFromRGB(0xffea5c)]; + } + return _giftNumLabel; +} + +- (UIImageView *)moneyImageView { + if (!_moneyImageView) { + _moneyImageView = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + } + return _moneyImageView; +} + +@end + +@interface LuckyPackageRecordsListView : UIView + +@property(nonatomic, strong) NSMutableArray *dataSource; +@property(nonatomic, strong) UITableView *tableView; +@property(nonatomic, assign) NSInteger type; +@property(nonatomic, strong) UIImageView *emptyImage; + +@end + +@implementation LuckyPackageRecordsListView + +- (instancetype)init +{ + self = [super init]; + if (self) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.backgroundColor = [UIColor clearColor]; + _tableView.separatorColor = UIColorFromRGB(0xb75a6f); + _tableView.separatorInset = UIEdgeInsetsMake(0, 0, 0, 0); // 左右间距 15 + [_tableView registerClass:[LuckyPackageRecordsCell class] forCellReuseIdentifier:@"LuckyPackageRecordsCell"]; + [self addSubview:_tableView]; + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.bottom.mas_equalTo(self); + make.leading.trailing.mas_equalTo(self).inset(22.5); + }]; + + _emptyImage = [[UIImageView alloc] initWithImage:kImage(@"缺省")]; + _emptyImage.hidden = YES; + [self addSubview:_emptyImage]; + [self.emptyImage mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.centerX.mas_equalTo(self); + make.size.mas_equalTo(CGSizeMake(123, 123)); + }]; + } + return self; +} + +- (void)setDataSource:(NSMutableArray *)dataSource { + _dataSource = dataSource; + [self.tableView reloadData]; + + self.emptyImage.hidden = dataSource.count > 0; + +} + +#pragma mark - +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 60; +} + +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.dataSource.count; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + LuckyPackageRecordsCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LuckyPackageRecordsCell" forIndexPath:indexPath]; + cell.type = self.type; + cell.cellModel = [self.dataSource xpSafeObjectAtIndex:indexPath.row]; + return cell; +} + + +@end + + +@interface LuckyPackageRecordsView : UIView +{ + UIImageView *backgroundImageView; + UIView *topButtonsContainer; + UIView *selectedPill; +} +@property(nonatomic, strong) NetImageView *avatarImageView; +@property(nonatomic, strong) UILabel *nickLabel; +@property(nonatomic, strong) LuckyPackageRecordsListView *sentRecordsView; +@property(nonatomic, strong) LuckyPackageRecordsListView *receiveRecordsView; +@property(nonatomic, strong) UIButton *backButton; +@property(nonatomic, strong) UIButton *receivedButton; +@property(nonatomic, strong) UIButton *sentButton; +@property(nonatomic, assign) BOOL currentSelectedIsReceive; +@property(nonatomic, copy)void(^tapBackButton)(void); +@property(nonatomic, copy)void(^switchTap)(BOOL isReceive); + +@property(nonatomic, copy)NSArray *dateSource; + +- (void)updateWithUserInfo:(UserInfoModel *)userInfo; + +@end + +@implementation LuckyPackageRecordsView + +- (instancetype)init +{ + self = [super init]; + if (self) { + backgroundImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_records_bg")]; + [self addSubview:backgroundImageView]; + [backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + topButtonsContainer = [[UIView alloc] init]; + topButtonsContainer.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2]; + [topButtonsContainer setCornerRadius:17.5]; + [self addSubview:topButtonsContainer]; + [topButtonsContainer mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(40); + make.leading.trailing.mas_equalTo(self).inset(23); + make.height.mas_equalTo(35); + }]; + + selectedPill = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 165, 35)]; + [selectedPill addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xfff437), + UIColorFromRGB(0xff9f00) + ] + startPoint:CGPointMake(0.5, 0) + endPoint:CGPointMake(0.5, 1) + cornerRadius:17.5]; + + [self addSubview:selectedPill]; + + [self addSubview:self.sentButton]; + [self addSubview:self.receivedButton]; + [self.sentButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.trailing.bottom.mas_equalTo(topButtonsContainer); + make.width.mas_equalTo(topButtonsContainer.mas_width).multipliedBy(0.5); + }]; + [self.receivedButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.bottom.mas_equalTo(topButtonsContainer); + make.width.mas_equalTo(topButtonsContainer.mas_width).multipliedBy(0.5); + }]; + + [selectedPill mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.receivedButton); + make.size.mas_equalTo(self.receivedButton); + }]; + + [self addSubview:self.avatarImageView]; + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(topButtonsContainer.mas_bottom).offset(14); + make.size.mas_equalTo(65); + }]; + + [self addSubview:self.nickLabel]; + [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(9); + }]; + + [self addSubview:self.backButton]; + [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self); + make.leading.mas_equalTo(11); + make.size.mas_equalTo(CGSizeMake(30, 30)); + }]; + + [self addSubview:self.sentRecordsView]; + [self addSubview:self.receiveRecordsView]; + [self.sentRecordsView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nickLabel.mas_bottom).offset(20); + make.leading.bottom.trailing.mas_equalTo(self); + }]; + [self.receiveRecordsView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.nickLabel.mas_bottom).offset(20); + make.leading.bottom.trailing.mas_equalTo(self); + }]; + + [self didTapReceive]; + } + return self; +} + +- (void)setDateSource:(NSArray *)dateSource { + _dateSource = dateSource; + if (self.currentSelectedIsReceive) { + [self.receiveRecordsView setDataSource:dateSource.mutableCopy]; + } else { + [self.sentRecordsView setDataSource:dateSource.mutableCopy]; + } + self.avatarImageView.hidden = dateSource.count == 0; + self.nickLabel.hidden = dateSource.count == 0; +} + +- (void)didTapBack { + if (_tapBackButton) { + _tapBackButton(); + } +} + +- (void)didTapSent { + if (!self.currentSelectedIsReceive) { + return; + } + [selectedPill mas_remakeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.sentButton); + make.size.mas_equalTo(self.sentButton); + }]; + self.sentButton.selected = YES; + self.receivedButton.selected = NO; + self.sentRecordsView.hidden = NO; + self.receiveRecordsView.hidden = YES; + self.currentSelectedIsReceive = NO; + if (_switchTap) { + self.switchTap(NO); + } +} + +- (void)didTapReceive { + if (self.currentSelectedIsReceive) { + return; + } + [selectedPill mas_remakeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self.receivedButton); + make.size.mas_equalTo(self.receivedButton); + }]; + self.sentButton.selected = NO; + self.receivedButton.selected = YES; + self.sentRecordsView.hidden = YES; + self.receiveRecordsView.hidden = NO; + self.currentSelectedIsReceive = YES; + if (_switchTap) { + self.switchTap(YES); + } +} + +- (void)updateWithUserInfo:(UserInfoModel *)userInfo { + self.avatarImageView.imageUrl = userInfo.avatar; + self.nickLabel.text = userInfo.nick; +} + +#pragma mark - +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.imageType = ImageTypeUserIcon; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + [_avatarImageView setAllCornerRadius:65/2 + borderWidth:2 + borderColor:UIColorFromRGB(0xffd168)]; + } + return _avatarImageView; +} + +- (UILabel *)nickLabel { + if (!_nickLabel) { + _nickLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0xffea5c)]; + _nickLabel.textAlignment = NSTextAlignmentCenter; + } + return _nickLabel; +} + +- (LuckyPackageRecordsListView *)sentRecordsView { + if (!_sentRecordsView) { + _sentRecordsView = [[LuckyPackageRecordsListView alloc] init]; + _sentRecordsView.type = 1; + } + return _sentRecordsView; +} + +- (LuckyPackageRecordsListView *)receiveRecordsView { + if (!_receiveRecordsView) { + _receiveRecordsView = [[LuckyPackageRecordsListView alloc] init]; + _receiveRecordsView.type = 2; + } + return _receiveRecordsView; +} + +- (UIButton *)backButton { + if (!_backButton) { + _backButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_backButton setImage:kImage(@"luck_package_records_back") forState:UIControlStateNormal]; + [_backButton addTarget:self action:@selector(didTapBack) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +- (UIButton *)sentButton { + if (!_sentButton) { + _sentButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_sentButton setTitle:YMLocalizedString(@"1.0.37_text_15") forState:UIControlStateNormal]; + [_sentButton setTitleColor:UIColorFromRGB(0xffea5c) forState:UIControlStateNormal]; + [_sentButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateSelected]; + [_sentButton addTarget:self action:@selector(didTapSent) forControlEvents:UIControlEventTouchUpInside]; + } + return _sentButton; +} + +- (UIButton *)receivedButton { + if (!_receivedButton) { + _receivedButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_receivedButton setTitle:YMLocalizedString(@"1.0.37_text_14") forState:UIControlStateNormal]; + [_receivedButton setTitleColor:UIColorFromRGB(0xffea5c) forState:UIControlStateNormal]; + [_receivedButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateSelected]; + [_receivedButton addTarget:self action:@selector(didTapReceive) forControlEvents:UIControlEventTouchUpInside]; + _receivedButton.selected = YES; + } + return _receivedButton; +} +@end + +@interface GiftCountCalculator : UIView +@property(nonatomic, assign) NSInteger count; + +@property(nonatomic, strong) UILabel *countLabel; +@property(nonatomic, strong) UIButton *reduceButton; +@property(nonatomic, strong) UIButton *increaseButton; + +@property(nonatomic, copy) void(^tapReduce)(NSInteger count); +@property(nonatomic, copy) void(^tapIncrease)(NSInteger count); +@property(nonatomic, copy) void(^tapCountLabel)(void); + +- (void)reset; +- (void)updateCount:(NSInteger)count; +@end + +@implementation GiftCountCalculator + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.count = 0; + + self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2]; + [self setCornerRadius:4]; + + _countLabel = [UILabel labelInitWithText:@"0" font:kFontMedium(12) textColor:[UIColor whiteColor]]; + _countLabel.textAlignment = NSTextAlignmentCenter; + _countLabel.backgroundColor = [UIColor colorWithWhite:0 alpha:0.3]; + _countLabel.userInteractionEnabled = YES; + [_countLabel setCornerRadius:4]; + + _reduceButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_reduceButton setImage:kImage(@"luck_package_item_reduce") forState:UIControlStateNormal]; + [_reduceButton addTarget:self action:@selector(didTapReduce) forControlEvents:UIControlEventTouchUpInside]; + + _increaseButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_increaseButton setImageEdgeInsets:UIEdgeInsetsMake(2, 2, 2, 2)]; + [_increaseButton setImage:kImage(@"mine_guild_add_room") forState:UIControlStateNormal]; + [_increaseButton addTarget:self action:@selector(didTapIncrease) forControlEvents:UIControlEventTouchUpInside]; + + [self addSubview:self.countLabel]; + [self addSubview:self.reduceButton]; + [self addSubview:self.increaseButton]; + [self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self); + make.size.mas_equalTo(CGSizeMake(22, 18)); + }]; + [self.reduceButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.bottom.mas_equalTo(self); + make.width.mas_equalTo(self.reduceButton.mas_height); + }]; + + [self.increaseButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.trailing.bottom.mas_equalTo(self); + make.width.mas_equalTo(self.reduceButton.mas_height); + }]; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(displayKeyboard)]; + [self.countLabel addGestureRecognizer:tap]; + } + return self; +} + +- (void)reset { + self.count = 0; + self.countLabel.text = @"0"; +} + +- (void)updateCount:(NSInteger)count { + self.count = count; + self.countLabel.text = @(self.count).stringValue; +} + +- (void)didTapReduce { + _count = MAX(0, _count-1); + self.countLabel.text = @(self.count).stringValue; + if (_tapReduce) { + _tapReduce(_count); + } +} + +- (void)didTapIncrease { + _count = MIN(99, _count+1); + self.countLabel.text = @(self.count).stringValue; + if (_tapIncrease) { + _tapIncrease(_count); + } +} + +- (void)displayKeyboard { + if (_tapCountLabel) { + self.tapCountLabel(); + } +} + +@end + +@interface OneLineImageItemCell : UICollectionViewCell + +- (void)updateCell:(NSNumber *)content index:(NSInteger)index; + +@end + +@implementation OneLineImageItemCell +{ + UIImageView *normalBGImageView; + UIImageView *selectedBGImageView; + UIImageView *iconImageView; + UILabel *numberLabel; + UIImageView *moneyImageView; +} + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + [self.contentView setCornerRadius:12 + corners:UIRectCornerTopLeft|UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight + borderWidth:1 + borderColor:UIColorFromRGB(0xffd168)]; + normalBGImageView = [[UIImageView alloc] initWithImage:[UIImage gradientColorImageFromColors:@[ + UIColorFromRGB(0x97000c), + UIColorFromRGB(0x610015) + ] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(75, 100)]]; + selectedBGImageView = [[UIImageView alloc] initWithImage:[UIImage gradientColorImageFromColors:@[ + UIColorFromRGB(0xFFF437), + UIColorFromRGB(0xFF9f00) + ] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(75, 100)]]; + selectedBGImageView.hidden = YES; + + iconImageView = [[UIImageView alloc] init]; + numberLabel = [UILabel labelInitWithText:@"0" font:kFontRegular(13) textColor:UIColorFromRGB(0xffea5c)]; + moneyImageView = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + moneyImageView.contentMode = UIViewContentModeScaleAspectFit; + UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + numberLabel, + moneyImageView + ]]; + stack.spacing = 2.5; + stack.axis = UILayoutConstraintAxisHorizontal; + + [self.contentView addSubview:normalBGImageView]; + [self.contentView addSubview:selectedBGImageView]; + [self.contentView addSubview:iconImageView]; + [self.contentView addSubview:stack]; + + [normalBGImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView); + }]; + [selectedBGImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.contentView); + }]; + [iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.contentView).inset(6.5); + make.height.mas_equalTo(iconImageView.mas_width); + }]; + [stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.bottom.mas_equalTo(self.contentView).offset(-6); + make.height.mas_equalTo(16); + }]; + } + return self; +} + +- (void)setSelected:(BOOL)selected { + [super setSelected:selected]; + + if (selected) { + normalBGImageView.hidden = YES; + selectedBGImageView.hidden = NO; + numberLabel.textColor = UIColorFromRGB(0x292601); + } else { + normalBGImageView.hidden = NO; + selectedBGImageView.hidden = YES; + numberLabel.textColor = UIColorFromRGB(0xffea5c); + } +} + +- (void)updateCell:(NSNumber *)content index:(NSInteger)index { + switch (index) { + case 0: + iconImageView.image = kImage(@"luck_package_bag_lv1"); + break; + case 1: + iconImageView.image = kImage(@"luck_package_bag_lv2"); + break; + case 2: + iconImageView.image = kImage(@"luck_package_bag_lv3"); + break; + case 3: + iconImageView.image = kImage(@"luck_package_bag_lv4"); + break; + + default: + break; + } + numberLabel.text = content.stringValue; +} + +@end + +@interface OneLineImageButtons : UIView +@property(nonatomic, copy) NSArray *dataSource; +@property(nonatomic, copy) void(^didSelected)(NSInteger index); +@end + +@implementation OneLineImageButtons +{ + UICollectionView *collectionView; +} + +- (instancetype)init +{ + self = [super init]; + if (self) { + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.itemSize = CGSizeMake(kGetScaleWidth(75), kGetScaleWidth(100)); + layout.sectionInset = UIEdgeInsetsMake(0, 20, 0, 20); + collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + collectionView.backgroundColor = [UIColor clearColor]; + collectionView.delegate = self; + collectionView.dataSource = self; + [collectionView registerClass:[OneLineImageItemCell class] forCellWithReuseIdentifier:@"OneLineImageItemCell"]; + [self addSubview:collectionView]; + [collectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + } + return self; +} + +- (void)setDataSource:(NSArray *)dataSource { + _dataSource = dataSource; + [collectionView reloadData]; + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *firstIndexPath = [NSIndexPath indexPathForItem:0 inSection:0]; + [self->collectionView selectItemAtIndexPath:firstIndexPath + animated:NO + scrollPosition:UICollectionViewScrollPositionNone]; + }); +} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.dataSource.count; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + OneLineImageItemCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"OneLineImageItemCell" forIndexPath:indexPath]; + [cell updateCell:[self.dataSource xpSafeObjectAtIndex:indexPath.item] index:indexPath.item]; + return cell; +} + +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + if (_didSelected) { + self.didSelected(indexPath.item); + } +} + +@end + +@interface OneLineButtons : UIView +@property(nonatomic, copy) NSArray *dataSource; +@property(nonatomic, copy) void(^didSelected)(NSInteger index); +@end + +@implementation OneLineButtons +{ + UIButton *button_1; + UIButton *button_2; + UIButton *button_3; + UIButton *button_4; +} +- (instancetype)init +{ + self = [super init]; + if (self) { + button_1 = [self createButton:0]; + button_2 = [self createButton:1]; + button_3 = [self createButton:2]; + button_4 = [self createButton:3]; + UIStackView *stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + button_1, + button_2, + button_3, + button_4 + ]]; + stack.spacing = 10; + stack.distribution = UIStackViewDistributionFillEqually; + [self addSubview:stack]; + [stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self).insets(UIEdgeInsetsMake(0, 20, 0, 20)); + }]; + + button_1.selected = YES; + } + return self; +} + +- (UIButton *)createButton:(NSInteger)tag { + UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom]; + b.tag = tag; + b.frame = CGRectMake(0, 0, kGetScaleWidth(80), 30); + UIImage *normalImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x97000C), UIColorFromRGB(0x610015)] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(kGetScaleWidth(80), 30)]; + UIImage *selectedImage = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFF437), UIColorFromRGB(0xFF9F00)] + gradientType:GradientTypeTopToBottom + imgSize:CGSizeMake(kGetScaleWidth(80), 30)]; + [b setCornerRadius:6 + corners:UIRectCornerTopLeft|UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight + borderWidth:0.5 + borderColor:UIColorFromRGB(0xFEF057)]; + [b setBackgroundImage:normalImage forState:UIControlStateNormal]; + [b setBackgroundImage:selectedImage forState:UIControlStateSelected]; + [b setTitleColor:UIColorFromRGB(0xFFEA5C) forState:UIControlStateNormal]; + [b setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateSelected]; + [b.titleLabel setFont:kFontRegular(12)]; + [b addTarget:self action:@selector(handleTapEvent:) forControlEvents:UIControlEventTouchUpInside]; + + return b; +} + +- (void)setDataSource:(NSArray *)dataSource { + _dataSource = dataSource; + [button_1 setTitle:dataSource[0] forState:UIControlStateNormal]; + [button_2 setTitle:dataSource[1] forState:UIControlStateNormal]; + [button_3 setTitle:dataSource[2] forState:UIControlStateNormal]; + [button_4 setTitle:dataSource[3] forState:UIControlStateNormal]; +} + +- (void)handleTapEvent:(UIButton *)sender { + button_1.selected = NO; + button_2.selected = NO; + button_3.selected = NO; + button_4.selected = NO; + + sender.selected = YES; + + if (_didSelected) { + self.didSelected(sender.tag); + } +} + +@end + +@interface WalletBalanceDisplayView : UIView + +@property(nonatomic, strong) UIImageView *moneyImageView; +@property(nonatomic, strong) UILabel *balanceLabel; +@property(nonatomic, strong) UIButton *addButton; +@property(nonatomic, strong) UIView *spacer; +@property(nonatomic, strong) UIStackView *stack; +@property(nonatomic, copy) void(^tapAddButton)(void); + +- (void)hideAddButton; +- (void)updatePrice:(double)price; + +@end + +@implementation WalletBalanceDisplayView + +- (instancetype)init +{ + self = [super init]; + if (self) { + _moneyImageView = [[UIImageView alloc] initWithImage:kImage(@"moli_money_icon")]; + _moneyImageView.contentMode = UIViewContentModeScaleAspectFit; +// [self addSubview:self.moneyImageView]; + + _balanceLabel = [UILabel labelInitWithText:@"0" font:kFontMedium(15) textColor:UIColorFromRGB(0xFFEA5C)]; +// [self addSubview:self.balanceLabel]; + + _addButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_addButton setImage:kImage(@"luck_package_add") forState:UIControlStateNormal]; + [self.addButton addTarget:self action:@selector(didTapAddButton) forControlEvents:UIControlEventTouchUpInside]; + + _spacer = [[UIView alloc] init]; + self.spacer.backgroundColor = [UIColor clearColor]; + + _stack = [[UIStackView alloc] initWithArrangedSubviews:@[ + self.moneyImageView, + self.balanceLabel, + self.addButton, + self.spacer + ]]; + self.stack.spacing = 4; + self.stack.alignment = UIStackViewAlignmentLeading; + self.stack.distribution = UIStackViewDistributionFill; + [self addSubview:self.stack]; + [self.stack mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + // **让 spacer 充满右侧空间** + [self.spacer setContentHuggingPriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal]; + } + return self; +} + +- (void)hideAddButton { + self.addButton.hidden = YES; + self.spacer.hidden = YES; + self.stack.alignment = UIStackViewAlignmentCenter; +} + +- (void)updatePrice:(double)price { + self.balanceLabel.text = @(price).stringValue; +} + +- (void)didTapAddButton { + if (_tapAddButton) { + self.tapAddButton(); + } +} + +@end + +@interface ChooseViewTitleBar : UIView +@property(nonatomic, strong) UILabel *titleLabel; +@property(nonatomic, strong) UIImageView *leftImageView; +@property(nonatomic, strong) UIImageView *rightImageView; +- (void)updateTitle:(NSString *)content; +@end + +@implementation ChooseViewTitleBar + +- (instancetype)init +{ + self = [super init]; + if (self) { + _titleLabel = [UILabel labelInitWithText:@"" font:kFontMedium(14) textColor:UIColorFromRGB(0xffea5c)]; + if (isMSRTL()) { + _leftImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_right")]; + _rightImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_left")]; + } else { + _leftImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_left")]; + _rightImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_right")]; + } + + _leftImageView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + _rightImageView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + + [self addSubview:self.titleLabel]; + [self addSubview:self.leftImageView]; + [self addSubview:self.rightImageView]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.center.mas_equalTo(self); + make.height.mas_equalTo(18); + }]; + [self.leftImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.titleLabel); + make.trailing.mas_equalTo(self.titleLabel.mas_leading).offset(-15); + make.size.mas_equalTo(CGSizeMake(80, 15)); + }]; + [self.rightImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.titleLabel); + make.leading.mas_equalTo(self.titleLabel.mas_trailing).offset(15); + make.size.mas_equalTo(CGSizeMake(80, 15)); + }]; + } + return self; +} + +- (void)updateTitle:(NSString *)content { + self.titleLabel.text = content; +} + +@end + +@interface ChooseCoinView : UIView +@property(nonatomic, strong) UIScrollView *scrollView; +@property(nonatomic, strong) OneLineImageButtons *oneLineImageButtons; +@property(nonatomic, strong) ChooseViewTitleBar *luckyBagTitleBar; +@property(nonatomic, strong) ChooseViewTitleBar *waitingTitleBar; +@property(nonatomic, strong) OneLineButtons *luckyBagOneLineButtons; +@property(nonatomic, strong) OneLineButtons *waitingTimeOneLineButtons; +@property(nonatomic, strong) UILabel *totalCostLabel; +@property(nonatomic, strong) WalletBalanceDisplayView *walletView; +@property(nonatomic, strong) UIButton *sendButton; +@property(nonatomic, copy) void(^tapSendCoin)(void); +@end + +@implementation ChooseCoinView + +- (instancetype)init +{ + self = [super init]; + if (self) { + + _scrollView = [[UIScrollView alloc] init]; + [self addSubview:self.scrollView]; + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + // 创建容器视图,承载所有内容 + UIView *contentView = [[UIView alloc] init]; + contentView.backgroundColor = [UIColor clearColor]; + [self.scrollView addSubview:contentView]; + + // 使用 Masonry 设置容器视图的约束 + [contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.scrollView); // 与 scrollView 对齐 + make.width.mas_equalTo(self.scrollView); // 宽度与 scrollView 相同 + }]; + + _oneLineImageButtons = [[OneLineImageButtons alloc] init]; + [contentView addSubview:self.oneLineImageButtons]; + [self.oneLineImageButtons mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(50); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(kGetScaleWidth(100)); + }]; + + _luckyBagTitleBar = [[ChooseViewTitleBar alloc] init]; + [contentView addSubview:self.luckyBagTitleBar]; + [self.luckyBagTitleBar updateTitle:YMLocalizedString(@"1.0.37_text_8")]; + [self.luckyBagTitleBar mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.oneLineImageButtons.mas_bottom).offset(46); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(18); + }]; + + _luckyBagOneLineButtons = [[OneLineButtons alloc] init]; + [contentView addSubview:self.luckyBagOneLineButtons]; + [self.luckyBagOneLineButtons mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.luckyBagTitleBar.mas_bottom).offset(12.5); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(30); + }]; + + _waitingTitleBar = [[ChooseViewTitleBar alloc] init]; + [contentView addSubview:self.waitingTitleBar]; + [self.waitingTitleBar updateTitle:YMLocalizedString(@"1.0.37_text_5")]; + [self.waitingTitleBar mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.luckyBagOneLineButtons.mas_bottom).offset(46); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(18); + }]; + + + _waitingTimeOneLineButtons = [[OneLineButtons alloc] init]; + [contentView addSubview:self.waitingTimeOneLineButtons]; + [self.waitingTimeOneLineButtons mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.waitingTitleBar.mas_bottom).offset(12.5); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(30); + }]; + + _totalCostLabel = [UILabel labelInitWithText:@"" font:kFontRegular(12) textColor:UIColorFromRGB(0xffea5c)]; + _totalCostLabel.textAlignment = NSTextAlignmentCenter; + [contentView addSubview:self.totalCostLabel]; + [self.totalCostLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.waitingTimeOneLineButtons.mas_bottom).offset(30); + make.leading.trailing.mas_equalTo(contentView); + }]; + + UIView *space = [[UIView alloc] init]; + + [contentView addSubview:space]; + [space mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(contentView); + make.top.mas_equalTo(self.totalCostLabel.mas_bottom); + make.height.mas_equalTo(100); + }]; + + _walletView = [[WalletBalanceDisplayView alloc] init]; + [_walletView setTapAddButton:^{ +// @kStrongify(self); +// [self gotoChargeView]; + }]; + [self addSubview:self.walletView]; + [self.walletView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self).offset(-32); + make.leading.mas_equalTo(self).offset(23); + make.width.mas_equalTo(150); + make.height.mas_equalTo(24); + }]; + + _sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_sendButton.titleLabel setFont:kFontSemibold(15)]; + [_sendButton setBackgroundImage:kImage(@"luck_package_send_bg") forState:UIControlStateNormal]; + [_sendButton setTitle:YMLocalizedString(@"1.0.37_text_15.2") forState:UIControlStateNormal]; + [_sendButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateNormal]; + [_sendButton addTarget:self action:@selector(didTapSendButton) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:self.sendButton]; + [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.trailing.mas_equalTo(self).offset(-18); + make.width.mas_equalTo(190); + make.height.mas_equalTo(50); + }]; + + + + [self setupDataSource]; + } + return self; +} + +- (void)setupDataSource { + NSArray *moneys = [[LuckyPackageLogicManager sharedInstance] loadConfigLuckyBagMoneys]; + [self.oneLineImageButtons setDataSource:moneys]; + [self.oneLineImageButtons setDidSelected:^(NSInteger index) { + [[LuckyPackageLogicManager sharedInstance] updateSelectedBag:[moneys[index] integerValue]]; + }]; + + NSMutableArray *arr_bag = @[].mutableCopy; + NSArray *bagNumber = [[LuckyPackageLogicManager sharedInstance] loadConfigLuckyBagNumbers]; + for (NSNumber *num in bagNumber) { + [arr_bag addObject:num.stringValue]; + } + [self.luckyBagOneLineButtons setDataSource:arr_bag.copy]; + [self.luckyBagOneLineButtons setDidSelected:^(NSInteger index) { + [[LuckyPackageLogicManager sharedInstance] updateSelectedBagNum:[bagNumber[index] integerValue]]; + }]; + + NSArray *times = [[LuckyPackageLogicManager sharedInstance] loadConfigWaitingTimesMins]; + NSMutableArray *arr_time = @[].mutableCopy; + for (NSNumber *time in times) { + [arr_time addObject:[NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_7"), time]]; + } + [self.waitingTimeOneLineButtons setDataSource:arr_time.copy]; + [self.waitingTimeOneLineButtons setDidSelected:^(NSInteger index) { + [[LuckyPackageLogicManager sharedInstance] updateSelectedBagWaitingTime:[times[index] integerValue] * 60]; + }]; + + [self.walletView updatePrice:[[LuckyPackageLogicManager sharedInstance] loadSavedWalletInfo].diamonds.doubleValue]; + + self.totalCostLabel.text = [[LuckyPackageLogicManager sharedInstance] loadCoinTotalCostString]; + + @kWeakify(self); + [[LuckyPackageLogicManager sharedInstance] registerCoinTotalCostString:^(NSString * _Nonnull content) { + @kStrongify(self); + self.totalCostLabel.text = content; + }]; +} + +- (void)didTapSendButton { + if (_tapSendCoin) { + _tapSendCoin(); + } +} + +@end + +@interface ChooseGiftCell : UICollectionViewCell + +@property(nonatomic, strong) GiftInfoModel *cellModel; +@property(nonatomic, assign) NSInteger giftCount; + +@property(nonatomic, strong) UIView *bgView; +@property(nonatomic, strong) NetImageView *giftIconImageView; +@property(nonatomic, strong) UILabel *giftNameLabel; +@property(nonatomic, strong) UILabel *giftCountLabel; +@property(nonatomic, strong) GiftCountCalculator *giftCountView; +@property(nonatomic, strong) MoliMoneyLabel *priceLabel; + +@property(nonatomic, copy) void(^modifySelectedGift)(GiftInfoModel *model, NSInteger count); +@property(nonatomic, copy) void(^editGiftCount)(GiftInfoModel *model); + +@end + +@implementation ChooseGiftCell + +- (instancetype)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + self.contentView.backgroundColor = [UIColor clearColor]; + + [self.contentView addSubview:self.bgView]; + [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.contentView); + make.height.mas_equalTo(self.bgView.mas_width); + }]; + + [self.contentView addSubview:self.giftIconImageView]; + [self.giftIconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.bgView).insets(UIEdgeInsetsMake(6, 6, 6, 6)); + }]; + + [self.contentView addSubview:self.giftNameLabel]; + [self.giftNameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.bgView.mas_bottom).offset(6); + make.height.mas_equalTo(14); + }]; + + [self.contentView addSubview:self.priceLabel]; + [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.giftNameLabel.mas_bottom).offset(3); + make.height.mas_equalTo(16); + }]; + + [self.contentView addSubview:self.giftCountView]; + [self.giftCountView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.priceLabel.mas_bottom).offset(4); + make.height.mas_equalTo(20); + make.width.mas_equalTo(60); + }]; + } + return self; +} + +- (void)prepareForReuse { + [super prepareForReuse]; + [self.giftCountView reset]; +} + +- (void)setCellModel:(GiftInfoModel *)cellModel { + _cellModel = cellModel; + self.giftIconImageView.imageUrl = cellModel.giftUrl; + self.giftNameLabel.text = cellModel.giftName; + [self.priceLabel updateContent:@(cellModel.goldPrice).stringValue]; + [self.giftCountView updateCount:cellModel.luckyPackageCount]; +} + +- (void)setGiftCount:(NSInteger)giftCount { + _giftCount = giftCount; + if (!_giftCountLabel) { + [self.giftCountView removeFromSuperview]; + _giftCountLabel = [UILabel labelInitWithText:[NSString stringWithFormat:@"x%@", @(giftCount)] + font:kFontRegular(13) + textColor:UIColorFromRGB(0xffea5c)]; + [self.contentView addSubview:_giftCountLabel]; + [self.giftCountLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(self.priceLabel.mas_bottom).offset(2); + make.height.mas_equalTo(14); + }]; + } + self.giftCountLabel.text = [NSString stringWithFormat:@"x%@", @(giftCount)]; +} + +- (UIView *)bgView { + if (!_bgView) { + _bgView = [[UIView alloc] init]; + [_bgView addGradientBackgroundWithColors:@[UIColorFromRGB(0x610015), UIColorFromRGB(0x97000c)] + startPoint:CGPointMake(0.5, 0) + endPoint:CGPointMake(0.5, 1) + cornerRadius:12]; + [_bgView setCornerRadius:12 + corners:UIRectCornerTopLeft | UIRectCornerTopRight | UIRectCornerBottomLeft | UIRectCornerBottomRight + borderWidth:1 + borderColor:UIColorFromRGB(0xFEF057)]; + } + return _bgView; +} + +- (NetImageView *)giftIconImageView { + if (!_giftIconImageView) { + NetImageConfig *config = [[NetImageConfig alloc] init]; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _giftIconImageView = [[NetImageView alloc] initWithConfig:config]; + _giftIconImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _giftIconImageView; +} + +- (UILabel *)giftNameLabel { + if (!_giftNameLabel) { + _giftNameLabel = [UILabel labelInitWithText:@"Name" font:kFontRegular(13) textColor:UIColorFromRGB(0xffea5c)]; + _giftNameLabel.textAlignment = NSTextAlignmentCenter; + } + return _giftNameLabel; +} + +- (GiftCountCalculator *)giftCountView { + if (!_giftCountView) { + _giftCountView = [[GiftCountCalculator alloc] init]; + @kWeakify(self); + [_giftCountView setTapIncrease:^(NSInteger count){ + @kStrongify(self); + if (self.modifySelectedGift) { + self.modifySelectedGift(self.cellModel, count); + } + }]; + [_giftCountView setTapReduce:^(NSInteger count) { + @kStrongify(self); + if (self.modifySelectedGift) { + self.modifySelectedGift(self.cellModel, count); + } + }]; + [_giftCountView setTapCountLabel:^{ + @kStrongify(self); + if (self.editGiftCount) { + self.editGiftCount(self.cellModel); + } + }]; + } + return _giftCountView; +} + +- (MoliMoneyLabel *)priceLabel { + if (!_priceLabel) { + _priceLabel = [MoliMoneyLabel moneyLabelWithTextColot:UIColorFromRGB(0xffea5c) font:kFontRegular(13) moneyPostion:1 moneySize:CGSizeMake(16, 16)]; + } + return _priceLabel; +} + +@end + +@interface ChooseGiftView : UIView + +@property(nonatomic, assign) NSInteger watiingTime; +@property(nonatomic, strong) UIScrollView *scrollView; +@property(nonatomic, strong) ChooseViewTitleBar *chooseGiftTitleBar; +@property(nonatomic, strong) ChooseViewTitleBar *waitingTitleBar; +@property(nonatomic, strong) UICollectionView *giftsCollectionView; +@property(nonatomic, strong) UIPageControl *pageControl; +@property(nonatomic, strong) NSArray *dataSources; +@property(nonatomic, assign) NSInteger pageCount; +@property(nonatomic, strong) OneLineButtons *waitingTimeOneLineButtons; +@property(nonatomic, strong) UILabel *totalCostLabel; +@property(nonatomic, strong) WalletBalanceDisplayView *walletView; +@property(nonatomic, strong) UIButton *sendButton; + +@property(nonatomic, strong) UITextField *hiddenTextField; +@property(nonatomic, strong) UITextField *inputTextField; +@property(nonatomic, strong) GiftInfoModel *editingModel; +@property (nonatomic, strong) UIView *customInputView; + +@property(nonatomic, copy) void(^forceClose)(void); +@property(nonatomic, copy) void(^tapSendGift)(void); + +- (void)refreshData; + +@end + +@implementation ChooseGiftView + +- (instancetype)init +{ + self = [super init]; + if (self) { + + self.watiingTime = 5; + + @kWeakify(self); + + [[LuckyPackageLogicManager sharedInstance] registerGiftTotalCostString:^(NSAttributedString * _Nonnull content) { + @kStrongify(self); + self.totalCostLabel.attributedText = content; + } key:@"ChooseGiftView"]; + + _scrollView = [[UIScrollView alloc] init]; + [self addSubview:self.scrollView]; + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + // 创建容器视图,承载所有内容 + UIView *contentView = [[UIView alloc] init]; + contentView.backgroundColor = [UIColor clearColor]; + [self.scrollView addSubview:contentView]; + + // 使用 Masonry 设置容器视图的约束 + [contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.scrollView); // 与 scrollView 对齐 + make.width.mas_equalTo(self.scrollView); // 宽度与 scrollView 相同 + }]; + + _chooseGiftTitleBar = [[ChooseViewTitleBar alloc] init]; + [self.chooseGiftTitleBar updateTitle:YMLocalizedString(@"1.0.37_text_3")]; + _waitingTitleBar = [[ChooseViewTitleBar alloc] init]; + [self.waitingTitleBar updateTitle:YMLocalizedString(@"1.0.37_text_5")]; + + [contentView addSubview:self.chooseGiftTitleBar]; + [self.chooseGiftTitleBar mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(contentView).offset(6); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(18); + }]; + + CGFloat itemWidth = (KScreenWidth - 40 - 30)/4.0; + CGFloat itemHeight = kGetScaleWidth(75) + 6 + 12 + 3 + 16 + 4 + 28; + XPGiftCollectionViewFlowLayout *layout = [[XPGiftCollectionViewFlowLayout alloc] init]; + layout.minimumInteritemSpacing = 10; + layout.minimumLineSpacing = 10; + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + layout.itemSize = CGSizeMake(itemWidth, itemHeight); + layout.sectionInset = UIEdgeInsetsMake(10, 20, 0, 20); + + _giftsCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + _giftsCollectionView.clipsToBounds = YES; + _giftsCollectionView.backgroundColor = [UIColor clearColor]; + _giftsCollectionView.delegate = self; + _giftsCollectionView.dataSource = self; + _giftsCollectionView.pagingEnabled = YES; + _giftsCollectionView.showsHorizontalScrollIndicator = NO; + [_giftsCollectionView registerClass:[ChooseGiftCell class] forCellWithReuseIdentifier:@"ChooseGiftCell"]; + _giftsCollectionView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + [contentView addSubview:self.giftsCollectionView]; + [self.giftsCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(contentView); + make.top.mas_equalTo(self.chooseGiftTitleBar.mas_bottom).offset(10); + make.height.mas_equalTo(itemHeight * 2 + 30); + }]; + +// if (isMSRTL()) { +// _giftsCollectionView.transform = CGAffineTransformMakeScale(-1, 1); +// } + + _pageControl = [[UIPageControl alloc] init]; + _pageControl.numberOfPages = 1; + _pageControl.currentPage = 0; + _pageControl.pageIndicatorTintColor = [UIColor colorWithWhite:0 alpha:0.3]; + _pageControl.currentPageIndicatorTintColor = UIColorFromRGB(0xffea5c); + [contentView addSubview:self.pageControl]; + [self.pageControl mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.giftsCollectionView.mas_bottom).offset(3); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(10); + }]; + + [contentView addSubview:self.waitingTitleBar]; + [self.waitingTitleBar mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.pageControl.mas_bottom).offset(10); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(18); + }]; + + _waitingTimeOneLineButtons = [[OneLineButtons alloc] init]; + [_waitingTimeOneLineButtons setDidSelected:^(NSInteger index) { + @kStrongify(self); + [self selectWaitingTime:index]; + }]; + [contentView addSubview:_waitingTimeOneLineButtons]; + [self.waitingTimeOneLineButtons mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.waitingTitleBar.mas_bottom).offset(12); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(30); + }]; + + _walletView = [[WalletBalanceDisplayView alloc] init]; + [_walletView setTapAddButton:^{ + @kStrongify(self); + [self gotoChargeView]; + }]; + [self addSubview:self.walletView]; + [self.walletView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self).offset(-32); + make.leading.mas_equalTo(self).offset(23); + make.width.mas_equalTo(150); + make.height.mas_equalTo(24); + }]; + + _sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_sendButton.titleLabel setFont:kFontSemibold(15)]; + [_sendButton setBackgroundImage:kImage(@"luck_package_send_bg") forState:UIControlStateNormal]; + [_sendButton setTitle:YMLocalizedString(@"1.0.37_text_15.1") forState:UIControlStateNormal]; + [_sendButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateNormal]; + [_sendButton addTarget:self action:@selector(didTapSendButton) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:self.sendButton]; + [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.trailing.mas_equalTo(self).offset(-18); + make.width.mas_equalTo(190); + make.height.mas_equalTo(50); + }]; + + _totalCostLabel = [UILabel labelInitWithText:@"" + font:kFontRegular(12) + textColor:UIColorFromRGB(0xFFEA5C)]; + _totalCostLabel.attributedText = [[LuckyPackageLogicManager sharedInstance] loadGiftTotalCostString]; + _totalCostLabel.textAlignment = NSTextAlignmentCenter; + [contentView addSubview:_totalCostLabel]; + [self.totalCostLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.bottom.mas_equalTo(contentView).offset(-75); + make.top.mas_equalTo(self.waitingTimeOneLineButtons.mas_bottom).offset(12); + make.leading.trailing.mas_equalTo(contentView); + make.height.mas_equalTo(20); + }]; + + NSArray *times = [[LuckyPackageLogicManager sharedInstance] loadConfigWaitingTimesMins]; + NSMutableArray *arr = @[].mutableCopy; + for (NSNumber *time in times) { + [arr addObject:[NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_7"), time]]; + } + [self.waitingTimeOneLineButtons setDataSource:arr.copy]; + + self.hiddenTextField = [[UITextField alloc] initWithFrame:CGRectMake(KScreenWidth, KScreenHeight, KScreenWidth, 50)]; + self.hiddenTextField.keyboardType = UIKeyboardTypeNumberPad; + [self addSubview:self.hiddenTextField]; + self.customInputView = [self createInputAccessoryView]; + self.hiddenTextField.inputAccessoryView = self.customInputView; + + UIView *space = [[UIView alloc] init]; + + [contentView addSubview:space]; + [space mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(contentView); + make.top.mas_equalTo(self.totalCostLabel.mas_bottom); + make.height.mas_equalTo(100); + }]; + } + return self; +} + +- (void)refreshData { + [self.giftsCollectionView reloadData]; +} + +- (void)setDataSources:(NSArray *)dataSources { + _dataSources = dataSources; + + self.pageCount = ceil(self.dataSources.count / 8.0); + self.pageControl.numberOfPages = self.pageCount; + [self.giftsCollectionView reloadData]; + dispatch_async(dispatch_get_main_queue(), ^{ + [self adjustCollectionViewContentInset]; + }); +} + +// **创建 inputAccessoryView(输入栏 + 确认按钮)** +- (UIView *)createInputAccessoryView { + UIView *toolbar = [[UIView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 50)]; + toolbar.backgroundColor = UIColorFromRGB(0xf4f4f4); + + // **确认按钮** + UIButton *confirmButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [confirmButton setTitle:YMLocalizedString(@"TTAlertConfig0") forState:UIControlStateNormal]; + [confirmButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [confirmButton.titleLabel setFont:kFontRegular(14)]; + [confirmButton setCornerRadius:17]; + [confirmButton addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xe29030), + UIColorFromRGB(0xfcc074) + ] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 1) cornerRadius:17]; + [confirmButton addTarget:self action:@selector(confirmButtonTapped:) forControlEvents:UIControlEventTouchUpInside]; + [toolbar addSubview:confirmButton]; + [confirmButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(toolbar); + make.trailing.mas_equalTo(toolbar).offset(-15); + make.size.mas_equalTo(CGSizeMake(74, 34)); + }]; + + // 输入栏 + UITextField *inputField = [[UITextField alloc] init]; + inputField.backgroundColor = [UIColor whiteColor]; + [inputField setCornerRadius:17]; + inputField.borderStyle = UITextBorderStyleNone; + inputField.keyboardType = UIKeyboardTypeNumberPad; + inputField.placeholder = YMLocalizedString(@"1.0.37_text_30"); + [inputField addTarget:self + action:@selector(textFieldDidChange:) + forControlEvents:UIControlEventEditingChanged]; + [toolbar addSubview:inputField]; + UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 8, 1)]; + inputField.leftView = paddingView; + inputField.leftViewMode = UITextFieldViewModeAlways; + [inputField mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(toolbar); + make.leading.mas_equalTo(toolbar).offset(15); + make.trailing.mas_equalTo(confirmButton.mas_leading).offset(-10); + make.height.mas_equalTo(34); + }]; + self.inputTextField = inputField; + + return toolbar; +} + +// **确认按钮点击事件** +- (void)confirmButtonTapped:(UIButton *)sender { + if (self.inputTextField.text.length > 0) { + self.editingModel.luckyPackageCount = self.inputTextField.text.integerValue; + } else { + self.editingModel.luckyPackageCount = 0; + } + [[LuckyPackageLogicManager sharedInstance] updateSelectedGift:self.editingModel + count:self.editingModel.luckyPackageCount]; + [self.giftsCollectionView reloadData]; + + // **收起键盘** + [self.hiddenTextField resignFirstResponder]; + [self.inputTextField resignFirstResponder]; + [self endEditing:YES]; +} + +#pragma mark - +- (void)textFieldDidChange:(UITextField *)textField { + NSInteger value = [textField.text integerValue]; + + if (value > 99) { + textField.text = @"99"; // 超过 99,强制改成 99 + } +} + +#pragma mark - +- (void)didTapSendButton { + if (_tapSendGift) { + _tapSendGift(); + } +} + +- (void)gotoChargeView { + XPIAPRechargeViewController * rechargeVC = [[XPIAPRechargeViewController alloc] init]; + rechargeVC.type = @"4"; + [[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:rechargeVC animated:YES]; + + if (_forceClose) { + self.forceClose(); + } +} + +- (void)selectWaitingTime:(NSInteger)index { + NSArray *times = [[LuckyPackageLogicManager sharedInstance] loadConfigWaitingTimesMins]; + NSNumber *num = [times xpSafeObjectAtIndex:index]; + self.watiingTime = num.integerValue; + [[LuckyPackageLogicManager sharedInstance] updateSelectedGiftWaitingTime:self.watiingTime * 60]; +} + +#pragma mark - + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.dataSources.count; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + ChooseGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChooseGiftCell" forIndexPath:indexPath]; + + cell.cellModel = [self.dataSources xpSafeObjectAtIndex:indexPath.item]; + + [cell setModifySelectedGift:^(GiftInfoModel *model, NSInteger count) { + model.luckyPackageCount = count; + [[LuckyPackageLogicManager sharedInstance] updateSelectedGift:model count:count]; + }]; + + @kWeakify(self); + [cell setEditGiftCount:^(GiftInfoModel *model) { + @kStrongify(self); + self.editingModel = model; + [self.hiddenTextField becomeFirstResponder]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.inputTextField.text = @(model.luckyPackageCount).stringValue; + [self.inputTextField becomeFirstResponder]; + }); + }]; + + return cell; +} + +// 监听滑动,更新 PageControl +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + CGFloat pageWidth = self.giftsCollectionView.frame.size.width; + NSInteger currentPage = (self.giftsCollectionView.contentOffset.x + pageWidth / 2) / pageWidth; + self.pageControl.currentPage = currentPage; +} + +- (void)adjustCollectionViewContentInset { + CGFloat pageWidth = self.giftsCollectionView.frame.size.width; + NSInteger totalPages = ceil((double)self.dataSources.count / 8.0); + CGFloat fullContentWidth = totalPages * pageWidth; + + CGFloat remainingWidth = fullContentWidth - self.giftsCollectionView.contentSize.width; + + if (remainingWidth > 0) { + self.giftsCollectionView.contentInset = UIEdgeInsetsMake(0, 0, 0, remainingWidth); + } +} + +@end + +@interface ComfirmChooseGiftView : UIView + +@property(nonatomic, strong) UIScrollView *scrollView; +@property(nonatomic, strong) UICollectionView *giftsCollectionView; // 不需要分页了 +@property(nonatomic, strong) UILabel *waitingTimeLabel; +@property(nonatomic, strong) UILabel *totalCostLabel; +@property(nonatomic, strong) UIButton *sendButton; +@property(nonatomic, strong) UIButton *modifyButton; + +@property(nonatomic, copy) void(^returnToModity)(void); +@property(nonatomic, copy) void(^tapButtonForGiftLuckyPackage)(void); + +- (void)refreshContent; + +@end + +@implementation ComfirmChooseGiftView + +- (instancetype)init +{ + self = [super init]; + if (self) { + self.backgroundColor = [UIColor clearColor]; + + @kWeakify(self); + [[LuckyPackageLogicManager sharedInstance] registerGiftTotalCostString:^(NSAttributedString * _Nonnull content) { + @kStrongify(self); + self.totalCostLabel.attributedText = content; + } key:@"ComfirmChooseGiftView"]; + + _scrollView = [[UIScrollView alloc] init]; + [self addSubview:self.scrollView]; + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + // 创建容器视图,承载所有内容 + UIView *contentView = [[UIView alloc] init]; + contentView.backgroundColor = [UIColor clearColor]; + [self.scrollView addSubview:contentView]; + // 使用 Masonry 设置容器视图的约束 + [contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.scrollView); // 与 scrollView 对齐 + make.width.mas_equalTo(self.scrollView); // 宽度与 scrollView 相同 + }]; + UIView *space = [[UIView alloc] init]; + + [contentView addSubview:space]; + + CGFloat itemWidth = (KScreenWidth - 40 - 30)/4.0; + CGFloat itemHeight = kGetScaleWidth(75) + 6 + 12 + 3 + 16 + 4 + 21; + UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init]; + layout.minimumInteritemSpacing = 10; + layout.minimumLineSpacing = 10; + layout.scrollDirection = UICollectionViewScrollDirectionHorizontal; + layout.itemSize = CGSizeMake(itemWidth, itemHeight); + layout.sectionInset = UIEdgeInsetsMake(0, 20, 0, 20); + _giftsCollectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout]; + _giftsCollectionView.clipsToBounds = YES; + _giftsCollectionView.backgroundColor = [UIColor clearColor]; + _giftsCollectionView.delegate = self; + _giftsCollectionView.dataSource = self; + _giftsCollectionView.pagingEnabled = NO; + _giftsCollectionView.showsHorizontalScrollIndicator = NO; + + [_giftsCollectionView registerClass:[ChooseGiftCell class] forCellWithReuseIdentifier:@"ChooseGiftCell"]; + [contentView addSubview:self.giftsCollectionView]; + [self.giftsCollectionView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.trailing.mas_equalTo(contentView); + make.top.mas_equalTo(contentView).offset(60); + make.height.mas_equalTo(itemHeight * 2 + 30); + }]; + + _waitingTimeLabel = [UILabel labelInitWithText: + [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_13"), @([[LuckyPackageLogicManager sharedInstance] loadGiftWaitingTime]/60)] + font:kFontMedium(14) + textColor:UIColorFromRGB(0xFFEA5C)]; + _waitingTimeLabel.textAlignment = NSTextAlignmentCenter; + [contentView addSubview:_waitingTimeLabel]; + [self.waitingTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { +// make.bottom.mas_equalTo(self.modifyButton.mas_top).offset(-24); + make.top.mas_equalTo(self.giftsCollectionView.mas_bottom).offset(30); + make.centerX.mas_equalTo(contentView); + make.height.mas_equalTo(16); + }]; + + _modifyButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_modifyButton.titleLabel setFont:kFontRegular(12)]; + [_modifyButton setTitleColor:UIColorFromRGB(0xffea5c) forState:UIControlStateNormal]; + NSTextAttachment *attchment = [[NSTextAttachment alloc] init]; + attchment.image = kImage(@"luck_package_arrow"); + attchment.bounds = CGRectMake(0, -1, 11, 11); + NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attchment]; + NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:YMLocalizedString(@"1.0.37_text_12") + attributes:@{ + NSFontAttributeName: kFontRegular(12), + NSForegroundColorAttributeName: UIColorFromRGB(0xffea5c) + }]; + [attributedString appendAttributedString:string]; + [_modifyButton setAttributedTitle:attributedString forState:UIControlStateNormal]; +// [_modifyButton setTitle:YMLocalizedString(@"1.0.37_text_12") forState:UIControlStateNormal]; + [_modifyButton addTarget:self action:@selector(didTapModifyButton) forControlEvents:UIControlEventTouchUpInside]; + [contentView addSubview:_modifyButton]; + [self.modifyButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.waitingTimeLabel.mas_bottom).offset(24); + make.centerX.mas_equalTo(contentView); + make.height.mas_equalTo(16); + }]; + + _totalCostLabel = [UILabel labelInitWithText:@"" + font:kFontRegular(12) + textColor:UIColorFromRGB(0xFFEA5C)]; + _totalCostLabel.textAlignment = NSTextAlignmentCenter; + [contentView addSubview:_totalCostLabel]; + [self.totalCostLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.modifyButton.mas_bottom).offset(24); + make.centerX.mas_equalTo(contentView); + make.height.mas_equalTo(16); + }]; + + [space mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(contentView); + make.top.mas_equalTo(self.totalCostLabel.mas_bottom); + make.height.mas_equalTo(100); + }]; + + _sendButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_sendButton.titleLabel setFont:kFontSemibold(15)]; + [_sendButton setBackgroundImage:kImage(@"luck_package_send_bg") forState:UIControlStateNormal]; + [_sendButton setTitle:YMLocalizedString(@"1.0.37_text_15.1") forState:UIControlStateNormal]; + [_sendButton setTitleColor:UIColorFromRGB(0x292601) forState:UIControlStateNormal]; + [_sendButton addTarget:self action:@selector(didTapSendButton) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:self.sendButton]; + [self.sendButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self).offset(-18); + make.width.mas_equalTo(190); + make.height.mas_equalTo(50); + }]; + } + return self; +} + +- (void)refreshContent { + [self.giftsCollectionView reloadData]; + self.waitingTimeLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.37_text_13"), @([[LuckyPackageLogicManager sharedInstance] loadGiftWaitingTime]/60)]; + self.totalCostLabel.attributedText = [[LuckyPackageLogicManager sharedInstance] loadGiftTotalCostString]; + + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *firstIndexPath = [NSIndexPath indexPathForItem:0 inSection:0]; + [self.giftsCollectionView scrollToItemAtIndexPath:firstIndexPath + atScrollPosition:UICollectionViewScrollPositionRight + animated:NO]; + }); +} + +- (void)didTapModifyButton { + if (_returnToModity) { + self.returnToModity(); + } +} + +- (void)didTapSendButton { + if (_tapButtonForGiftLuckyPackage) { + self.tapButtonForGiftLuckyPackage(); + } +} + +#pragma mark - +- (void)scrollViewDidScroll:(UIScrollView *)scrollView { + NSLog(@"%@", @(scrollView.contentOffset)); +} + +//- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView { +// return [[LuckyPackageLogicManager sharedInstance] numberOfGifts]; +//} + +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return [[LuckyPackageLogicManager sharedInstance] numberOfGifts]; +} + +- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { + ChooseGiftCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChooseGiftCell" forIndexPath:indexPath]; + cell.cellModel = [[LuckyPackageLogicManager sharedInstance] giftForIndex:indexPath.item]; +// cell.giftCount = [[LuckyPackageLogicManager sharedInstance] countOfGiftForIndex:indexPath.item]; + + [cell setModifySelectedGift:^(GiftInfoModel *model, NSInteger count) { + model.luckyPackageCount = count; + [[LuckyPackageLogicManager sharedInstance] updateSelectedGift:model count:count]; + }]; + + return cell; +} + +@end + +@interface LuckyPackageViewController () + +@property (nonatomic,weak) idhostDelegate; + +@property(nonatomic, strong) UIButton *closeButton; +@property(nonatomic, strong) UIImageView *bgImageView; +@property(nonatomic, strong) UIButton *giftButton; +@property(nonatomic, strong) UIButton *coinButton; +@property(nonatomic, strong) UIImageView *gemImageView; +@property(nonatomic, strong) UIButton *recordsButton; +@property(nonatomic, strong) UIButton *rulesButton; + +@property(nonatomic, strong) UIView *coinContainer; +@property(nonatomic, strong) UIView *giftContainer; + +@property(nonatomic, strong) UIView *createLuckyPackageContainer; +@property(nonatomic, strong) ChooseCoinView *chooseCoin; +@property(nonatomic, strong) ChooseGiftView *chooseGift; +@property(nonatomic, strong) ComfirmChooseGiftView *comfirmChooseGift; + +@property(nonatomic, strong) LuckyPackageRecordsView *recordsView; + +@property(nonatomic, strong) LuckyPackageBannerView *demoBanner; @end @implementation LuckyPackageViewController + +- (instancetype)initWithdelegate:(id)delegate { + self = [super init]; + if (self) { + self.hiddenNavBar = YES; + self.hostDelegate = delegate; + } + return self; +} + +- (LuckyPackagePresenter *)createPresenter { + return [[LuckyPackagePresenter alloc] init]; +} + - (void)viewDidLoad { [super viewDidLoad]; - // Do any additional setup after loading the view. + self.hiddenNavBar = YES; + + [self setupUI]; + [self displayChooseGift]; } -/* -#pragma mark - Navigation - -// In a storyboard-based application, you will often want to do a little preparation before navigation -- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { - // Get the new view controller using [segue destinationViewController]. - // Pass the selected object to the new view controller. +- (void)setupUI { + self.view.backgroundColor = [UIColor colorWithWhite:0 alpha:0.2]; + [self.view addSubview:self.createLuckyPackageContainer]; + [self.createLuckyPackageContainer mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.view); + }]; + + [self setupBG]; + [self setupControlArea]; +} + +- (void)setupBG { + [self.view addSubview:self.closeButton]; + + + [self.createLuckyPackageContainer addSubview:self.bgImageView]; + [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) { + if (iPhoneXSeries) { + make.edges.mas_equalTo(self.createLuckyPackageContainer).insets(UIEdgeInsetsMake(kGetScaleWidth(162), 0, 0, 0)); + } else { + make.edges.mas_equalTo(self.createLuckyPackageContainer).insets(UIEdgeInsetsMake(kNavigationHeight, 0, 0, 0)); + } + }]; + + [self.createLuckyPackageContainer addSubview:self.demoBanner]; + [self.demoBanner mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self.bgImageView.mas_top).offset(40); + make.leading.trailing.mas_equalTo(self.createLuckyPackageContainer); + make.height.mas_equalTo(kGetScaleWidth(100)); + }]; + + [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.leading.trailing.mas_equalTo(self.createLuckyPackageContainer); + make.bottom.mas_equalTo(self.demoBanner.mas_bottom); + }]; +} + +- (void)setupControlArea { + [self.createLuckyPackageContainer addSubview:self.giftButton]; + [self.createLuckyPackageContainer addSubview:self.coinButton]; + [self.createLuckyPackageContainer addSubview:self.gemImageView]; + + [self.giftButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(47); + make.top.mas_equalTo(self.bgImageView).offset(kGetScaleWidth(108)); + make.left.mas_equalTo(self.createLuckyPackageContainer).offset(8); + make.right.mas_equalTo(self.createLuckyPackageContainer.mas_centerX).offset(-1.5); + }]; + + [self.coinButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(47); + make.top.mas_equalTo(self.bgImageView).offset(kGetScaleWidth(108)); + make.right.mas_equalTo(self.createLuckyPackageContainer).offset(-8); + make.left.mas_equalTo(self.createLuckyPackageContainer.mas_centerX).offset(1.5); + }]; + + [self.gemImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.createLuckyPackageContainer); + make.centerY.mas_equalTo(self.giftButton); + make.size.mas_equalTo(CGSizeMake(62, 31)); + }]; + + [self.createLuckyPackageContainer addSubview:self.rulesButton]; + [self.createLuckyPackageContainer addSubview:self.recordsButton]; + [self.rulesButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.coinButton.mas_bottom).offset(2); + make.trailing.mas_equalTo(self.createLuckyPackageContainer).offset(-5); + make.size.mas_equalTo(CGSizeMake(27, 27)); + }]; + + [self.recordsButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.coinButton.mas_bottom).offset(2); + make.trailing.mas_equalTo(self.rulesButton.mas_leading).offset(-3); + make.size.mas_equalTo(CGSizeMake(27, 27)); + }]; +} + +- (void)setupChooseGift { + if (!_giftContainer) { + _giftContainer = [[UIView alloc] init]; + [self.giftContainer addSubview:self.chooseGift]; + [self.chooseGift mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.giftContainer); + }]; + } + [self.createLuckyPackageContainer addSubview:self.giftContainer]; + [self.giftContainer mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.rulesButton); + make.bottom.leading.trailing.mas_equalTo(self.view); + }]; + + [self.createLuckyPackageContainer bringSubviewToFront:self.rulesButton]; + [self.createLuckyPackageContainer bringSubviewToFront:self.recordsButton]; +} + +- (void)setupChooseCoin { + if (!_coinContainer) { + _coinContainer = [[UIView alloc] init]; + [self.coinContainer addSubview:self.chooseCoin]; + [self.chooseCoin mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.coinContainer); + }]; + } + [self.createLuckyPackageContainer addSubview:self.coinContainer]; + [self.coinContainer mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.rulesButton); + make.bottom.leading.trailing.mas_equalTo(self.view); + }]; + + [self.createLuckyPackageContainer bringSubviewToFront:self.rulesButton]; + [self.createLuckyPackageContainer bringSubviewToFront:self.recordsButton]; +} + +- (void)setupComfirmChooseGift { + [self.giftContainer addSubview:self.comfirmChooseGift]; + [self.comfirmChooseGift mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self.giftContainer); + }]; +} + +- (void)readyToSendGift { + if ([[LuckyPackageLogicManager sharedInstance] loadAllSelectedGifts].count == 0) { + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"1.0.37_text_29")]; + return; + } + + self.comfirmChooseGift.alpha = 0; + [self setupComfirmChooseGift]; + [self.comfirmChooseGift refreshContent]; + [UIView animateWithDuration:0.25 animations:^{ + self.comfirmChooseGift.alpha = 1; + self.chooseGift.alpha = 0; + }]; +} + +- (void)returnToModify { + [UIView animateWithDuration:0.25 animations:^{ + self.comfirmChooseGift.alpha = 0; + self.chooseGift.alpha = 1; + [self.chooseGift refreshData]; + } completion:^(BOOL finished) { + [self.comfirmChooseGift removeFromSuperview]; + }]; +} + +#pragma mark - +- (void)setupData { + NSString *roomUid = @(self.hostDelegate.getRoomInfo.uid).stringValue; + [self.presenter loadGifts:roomUid]; + [self.presenter loadWalletInfo]; +} + +- (void)loadGiftsSuccess:(NSArray *)gifts { + self.chooseGift.dataSources = gifts; +} + +- (void)loadWalletInfoSuccess:(WalletInfoModel *)walletInfo { + [[LuckyPackageLogicManager sharedInstance] saveWalletInfo:walletInfo]; + [self.chooseGift.walletView updatePrice:walletInfo.diamonds.doubleValue]; +} + +- (void)loadSentLuckyBag { + @kWeakify(self); + [self.presenter loadLuckyPackageRecords:1 type:1 success:^(NSArray * _Nonnull array) { + @kStrongify(self); + [self.recordsView setDateSource:array]; + }]; +} + +- (void)loadReceivedLuckyBag { + @kWeakify(self); + [self.presenter loadLuckyPackageRecords:1 type:2 success:^(NSArray * _Nonnull array) { + @kStrongify(self); + [self.recordsView setDateSource:array]; + }]; +} + +- (void)sendGiftLuckyPackage { + @kWeakify(self); + [self.presenter sendGiftLuckyPackage:self.hostDelegate.getRoomInfo.uid + uid:[[AccountInfoStorage instance] getUid] + waitingTime:[[LuckyPackageLogicManager sharedInstance] loadGiftWaitingTime] + selectedGifts:[[LuckyPackageLogicManager sharedInstance] loadAllSelectedGifts] + success:^{ + @kStrongify(self); + [self didTapCloseButton]; + }]; +} + + +- (void)sendCoinLuckyPackage { + @kWeakify(self); + [self.presenter sendCoinLuckyPackage:self.hostDelegate.getRoomInfo.uid + uid:[[AccountInfoStorage instance] getUid] + waitingTime:[[LuckyPackageLogicManager sharedInstance] loadCoinWaitingTime] + num:@([[LuckyPackageLogicManager sharedInstance] loadSelectedBagNum]) + goldNum:@([[LuckyPackageLogicManager sharedInstance] loadSelectedBagMoney]) + success:^{ + @kStrongify(self); + [self didTapCloseButton]; + }]; +} + +#pragma mark - +- (void)displayChooseGift { + if (_coinContainer) { + [self.coinContainer removeFromSuperview]; + } + [self setupChooseGift]; + [self setupData]; + + UserInfoModel *currentUser = [self.hostDelegate getUserInfo]; + [self.demoBanner updateDemoFor:1 nick:currentUser.nick avatar:currentUser.avatar]; +} + +- (void)displayChooseCoin { + if (_giftContainer) { + [self.giftContainer removeFromSuperview]; + } + [self setupChooseCoin]; + + UserInfoModel *currentUser = [self.hostDelegate getUserInfo]; + [self.demoBanner updateDemoFor:2 nick:currentUser.nick avatar:currentUser.avatar]; +} + +#pragma mark - +- (void)didTapCloseButton { + [self removeFromParentViewController]; + [self.view removeFromSuperview]; + if (_close) { + self.close(); + } + + [[LuckyPackageLogicManager sharedInstance] reset]; +} + +- (void)didTapGiftTabButton:(UIButton *)sender { + if (sender.isSelected) { + return; + } + sender.selected = YES; + self.coinButton.selected = NO; + + [self displayChooseGift]; +} + +- (void)didTapCoinTabButton:(UIButton *)sender { + if (sender.isSelected) { + return; + } + sender.selected = YES; + self.giftButton.selected = NO; + + [self displayChooseCoin]; +} + +- (void)didTapRecordsButton { + if (!_recordsView) { + _recordsView = [[LuckyPackageRecordsView alloc] init]; + @kWeakify(self); + [self.recordsView setTapBackButton:^{ + @kStrongify(self); + [UIView animateWithDuration:0.25 animations:^{ + self.recordsView.alpha = 0; + self.createLuckyPackageContainer.alpha = 1; + } completion:^(BOOL finished) { + [self.recordsView removeFromSuperview]; + }]; + }]; + + [self.recordsView setSwitchTap:^(BOOL isReceive) { + @kStrongify(self); + if (isReceive) { + [self loadReceivedLuckyBag]; + } else { + [self loadSentLuckyBag]; + } + }]; + + [self loadReceivedLuckyBag]; + } + self.recordsView.alpha = 0; + [self.view addSubview:self.recordsView]; + [self.recordsView mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(self.view); + make.height.mas_equalTo(485); + }]; + + [self.recordsView updateWithUserInfo:self.hostDelegate.getUserInfo]; + + [UIView animateWithDuration:0.25 animations:^{ + self.recordsView.alpha = 1; + self.createLuckyPackageContainer.alpha = 0; + }]; +} + +- (void)didTapRulesButton { + BOOL giftContainerHiddenStatus = self.createLuckyPackageContainer.hidden; + self.createLuckyPackageContainer.hidden = YES; + + XPWebViewController *vc = [[XPWebViewController alloc] initWithRoomUID:[LuckyPackageLogicManager sharedInstance].roomUid]; + vc.hiddenNavBar = YES; + vc.url = URLWithType(KLuckyPackageRule); + @kWeakify(vc); + [vc setCloseWebViewBlock:^(BOOL result) { + @kStrongify(vc); + [vc.view removeFromSuperview]; + [vc removeFromParentViewController]; + + self.createLuckyPackageContainer.hidden = giftContainerHiddenStatus; + }]; + vc.view.hidden = YES; + [self addChildViewController:vc]; + [self.view addSubview:vc.view]; + [vc.view mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.leading.trailing.mas_equalTo(self.view); + make.height.mas_equalTo(kGetScaleWidth(470)); + }]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + vc.view.hidden = NO; + }); +} + +#pragma mark - +- (UIButton *)closeButton { + if (!_closeButton) { + _closeButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_closeButton addTarget:self action:@selector(didTapCloseButton) forControlEvents:UIControlEventTouchUpInside]; + } + return _closeButton; +} + +- (UIImageView *)bgImageView { + if (!_bgImageView) { + _bgImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_main_bg")]; + _bgImageView.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + } + return _bgImageView; +} + +- (UIButton *)giftButton { + if (!_giftButton) { + _giftButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _giftButton.adjustsImageWhenHighlighted = NO; + [_giftButton.titleLabel setFont:kFontSemibold(16)]; + [_giftButton setTitleColor:UIColorFromRGB(0xffea5c) forState:UIControlStateNormal]; + [_giftButton setTitle:YMLocalizedString(@"1.0.37_text_1") forState:UIControlStateNormal]; + [_giftButton setBackgroundImage:kImage(@"luck_package_gift_button_normal") forState:UIControlStateNormal]; + [_giftButton setBackgroundImage:kImage(@"luck_package_gift_button_selected") forState:UIControlStateSelected]; + [_giftButton addTarget:self action:@selector(didTapGiftTabButton:) forControlEvents:UIControlEventTouchUpInside]; + _giftButton.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + + _giftButton.selected = YES; + } + return _giftButton; +} + +- (UIButton *)coinButton { + if (!_coinButton) { + _coinButton = [UIButton buttonWithType:UIButtonTypeCustom]; + _coinButton.adjustsImageWhenHighlighted = NO; + [_coinButton.titleLabel setFont:kFontSemibold(16)]; + [_coinButton setTitleColor:UIColorFromRGB(0xffea5c) forState:UIControlStateNormal]; + [_coinButton setTitle:YMLocalizedString(@"1.0.37_text_2") forState:UIControlStateNormal]; + [_coinButton setBackgroundImage:kImage(@"luck_package_coin_button_normal") forState:UIControlStateNormal]; + [_coinButton setBackgroundImage:kImage(@"luck_package_coin_button_selected") forState:UIControlStateSelected]; + [_coinButton addTarget:self action:@selector(didTapCoinTabButton:) forControlEvents:UIControlEventTouchUpInside]; + _coinButton.semanticContentAttribute = UISemanticContentAttributeForceLeftToRight; + } + return _coinButton; +} + +- (UIImageView *)gemImageView { + if (!_gemImageView) { + _gemImageView = [[UIImageView alloc] initWithImage:kImage(@"luck_package_gem")]; + } + return _gemImageView; +} + +- (UIButton *)recordsButton { + if (!_recordsButton) { + _recordsButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_recordsButton setBackgroundImage:kImage(@"luck_package_records") forState:UIControlStateNormal]; + [_recordsButton addTarget:self action:@selector(didTapRecordsButton) forControlEvents:UIControlEventTouchUpInside]; + } + return _recordsButton; +} + +- (UIButton *)rulesButton { + if (!_rulesButton) { + _rulesButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_rulesButton setBackgroundImage:kImage(@"luck_package_rules") forState:UIControlStateNormal]; + [_rulesButton addTarget:self action:@selector(didTapRulesButton) forControlEvents:UIControlEventTouchUpInside]; + } + return _rulesButton; +} + +- (ChooseCoinView *)chooseCoin { + if (!_chooseCoin) { + _chooseCoin = [[ChooseCoinView alloc] init]; + @kWeakify(self); + [_chooseCoin setTapSendCoin:^{ + @kStrongify(self); + [self sendCoinLuckyPackage]; + }]; + } + return _chooseCoin; +} + +- (ChooseGiftView *)chooseGift { + if (!_chooseGift) { + _chooseGift = [[ChooseGiftView alloc] init]; + @kWeakify(self); + [_chooseGift setForceClose:^{ + @kStrongify(self); + [self didTapCloseButton]; + }]; + [_chooseGift setTapSendGift:^{ + @kStrongify(self); + [self readyToSendGift]; + }]; + } + return _chooseGift; +} + +- (ComfirmChooseGiftView *)comfirmChooseGift { + if (!_comfirmChooseGift) { + _comfirmChooseGift = [[ComfirmChooseGiftView alloc] init]; + @kWeakify(self); + [_comfirmChooseGift setReturnToModity:^{ + @kStrongify(self); + [self returnToModify]; + }]; + [_comfirmChooseGift setTapButtonForGiftLuckyPackage:^{ + @kStrongify(self); + [self sendGiftLuckyPackage]; + }]; + } + return _comfirmChooseGift; +} + +- (UIView *)createLuckyPackageContainer { + if (!_createLuckyPackageContainer) { + _createLuckyPackageContainer = [[UIView alloc] init]; + } + return _createLuckyPackageContainer; +} + +- (LuckyPackageBannerView *)demoBanner { + if (!_demoBanner) { + _demoBanner = [LuckyPackageBannerView demoBanner]; + } + return _demoBanner; } -*/ @end diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.h b/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.h new file mode 100644 index 00000000..1e797655 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.h @@ -0,0 +1,18 @@ +// +// OpenLuckyPackageEntranceView.h +// YuMi +// +// Created by P on 2025/2/12. +// + +#import +@class RoomLuckyPackageInfoModel; +NS_ASSUME_NONNULL_BEGIN + +@interface OpenLuckyPackageEntranceView : UIView + +- (void)updateEntrance:(RoomLuckyPackageInfoModel *)model; + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.m b/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.m new file mode 100644 index 00000000..f1a7d893 --- /dev/null +++ b/YuMi/Modules/YMRoom/View/LuckyPackage/OpenLuckyPackageEntranceView.m @@ -0,0 +1,220 @@ +// +// OpenLuckyPackageEntranceView.m +// YuMi +// +// Created by P on 2025/2/12. +// + +#import "OpenLuckyPackageEntranceView.h" +#import "RoomLuckyPackageInfoModel.h" +#import "LuckyPackageLogicManager.h" +#import "LuckyPackageStatusView.h" +#import "XPSkillCardPlayerManager.h" + +@interface OpenLuckyPackageEntranceView () + +@property(nonatomic, strong) RoomLuckyPackageInfoModel *packageInfomodel; + +@property(nonatomic, strong) UIImageView *iconImageView; +@property(nonatomic, strong) UILabel *badgeLabel; +@property(nonatomic, strong) UILabel *counterLabel; +@property(nonatomic, strong) UIView *counterBgView; + +@property(nonatomic, strong) NSTimer *timer; +@property(nonatomic, assign) NSInteger gap; + +@property(nonatomic, strong) UIButton *button; +@property(nonatomic, strong) RedEnvelopeListVo *currentDisplayModel; + +@property(nonatomic, strong) UIActivityIndicatorView *loadingIndicator; + +@end + +@implementation OpenLuckyPackageEntranceView + +- (instancetype)init +{ + self = [super init]; + if (self) { + [self addSubview:self.iconImageView]; + [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self).offset(-4); + make.centerX.mas_equalTo(self); + make.size.mas_equalTo(CGSizeMake(50, 50)); + }]; + + [self addSubview:self.badgeLabel]; + [self.badgeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.trailing.mas_equalTo(self); + make.height.mas_equalTo(18); + make.width.mas_greaterThanOrEqualTo(18); + }]; + + [self addSubview:self.counterBgView]; + [self addSubview:self.counterLabel]; + [self.counterLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self).offset(-4); + make.height.mas_equalTo(18); + }]; + [self.counterBgView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.bottom.mas_equalTo(self).offset(-4); + make.height.mas_equalTo(18); + make.width.mas_equalTo(48); + }]; + + _button = [UIButton buttonWithType:UIButtonTypeCustom]; + [_button addTarget:self action:@selector(didTapSelf) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:_button]; + [self.button mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + + [self addSubview:self.loadingIndicator]; + [self.loadingIndicator mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(self); + }]; + } + return self; +} + +- (void)updateEntrance:(RoomLuckyPackageInfoModel *)model { + _packageInfomodel = model; + RedEnvelopeListVo *firstModel = [model.redEnvelopeListVoList xpSafeObjectAtIndex:0]; + if (!firstModel) { + self.hidden = YES; + return; + } + self.hidden = NO; + + self.currentDisplayModel = firstModel; + + self.iconImageView.image = [firstModel.type isEqualToString:@"GIFT"] ? kImage(@"luck_package_entrance_gift") : kImage(@"luck_package_entrance_coin"); + + NSInteger badgeNum = [[LuckyPackageLogicManager sharedInstance] packageBadgeNum]; + self.badgeLabel.text = badgeNum > 99 ? @"99+" : @(badgeNum).stringValue; + self.badgeLabel.hidden = badgeNum == 1; + + NSTimeZone *gmt8TimeZone = [NSTimeZone timeZoneForSecondsFromGMT:8 * 3600]; + NSCalendar *calendar = [NSCalendar currentCalendar]; + calendar.timeZone = gmt8TimeZone; + NSDateComponents *components = [calendar componentsInTimeZone:gmt8TimeZone fromDate:[NSDate date]]; + NSDate *gmt8Date = [calendar dateFromComponents:components]; + NSTimeInterval local = [gmt8Date timeIntervalSince1970]; + self.gap = (firstModel.beginTime - local * 1000)/1000; + if (self.gap > 0) { + self.badgeLabel.hidden = YES; + [self startTimer]; + } else { + self.badgeLabel.hidden = NO; + self.counterLabel.hidden = YES; + } + + self.badgeLabel.hidden = firstModel.redEnvelopeNum==0; +} + +- (void)startTimer { + [self stopTimer]; + self.counterLabel.hidden = NO; + self.counterBgView.hidden = NO; + self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 + target:self + selector:@selector(timerTick) + userInfo:nil + repeats:YES]; +} + +- (void)stopTimer { + if (self.timer) { + [self.timer invalidate]; + self.timer = nil; + self.counterLabel.hidden = YES; + self.counterBgView.hidden = YES; + } +} + +- (void)timerTick { + self.gap--; + [self updateLabel]; + + if (self.gap <= 0) { + [self stopTimer]; + } +} + +- (void)updateLabel { + NSInteger hours = self.gap / 3600; + NSInteger minutes = (self.gap % 3600)/60; + NSInteger second = self.gap % 60; + if (hours > 0) { + self.counterLabel.text = [NSString stringWithFormat:@"%02ld:%02ld", (long)hours, (long)minutes]; + } else { + self.counterLabel.text = [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)second]; + } +} + +- (void)didTapSelf { + if ([[[XPSkillCardPlayerManager shareInstance] userInfoModel] isRechargeUser]) { + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"1.0.37_text_52")]; + return; + } + RedEnvelopeListVo *firstModel = [self.packageInfomodel.redEnvelopeListVoList xpSafeObjectAtIndex:0]; + LuckyPackageStatusView *view = [[LuckyPackageStatusView alloc] initWithModel:firstModel gap:self.gap]; + + TTPopupConfig *config = [[TTPopupConfig alloc] init]; + config.contentView = view; + config.maskBackgroundAlpha = 0.2; + config.shouldDismissOnBackgroundTouch = NO; + [TTPopup popupWithConfig:config]; +} + +#pragma mark - +- (UIImageView *)iconImageView { + if (!_iconImageView) { + _iconImageView = [[UIImageView alloc] init]; + } + return _iconImageView; +} + +- (UILabel *)badgeLabel { + if (!_badgeLabel) { + _badgeLabel = [UILabel labelInitWithText:@"" font:kFontMedium(10) textColor:[UIColor whiteColor]]; + _badgeLabel.textAlignment = NSTextAlignmentCenter; + _badgeLabel.backgroundColor = UIColorFromRGB(0xF33A49); + [_badgeLabel setCornerRadius:9]; + } + return _badgeLabel; +} + +- (UIView *)counterBgView { + if (!_counterBgView) { + _counterBgView = [[UIView alloc] init]; + _counterBgView.hidden = YES; + [_counterBgView addGradientBackgroundWithColors:@[ + UIColorFromRGB(0xE55F00), + UIColorFromRGB(0xCD1700) + ] startPoint:CGPointMake(0, 0.5) endPoint:CGPointMake(1, 0.5) cornerRadius:17/2]; + [_counterBgView setAllCornerRadius:17/2 borderWidth:1 borderColor:UIColorFromRGB(0xfff2ca)]; + } + return _counterBgView; +} + +- (UILabel *)counterLabel { + if (!_counterLabel) { + _counterLabel = [UILabel labelInitWithText:@"" font:kFontSemibold(12) textColor:UIColorFromRGB(0xFFF4D3)]; + _counterLabel.textAlignment = NSTextAlignmentCenter; + } + return _counterLabel; +} + +- (UIActivityIndicatorView *)loadingIndicator { + if (!_loadingIndicator) { + _loadingIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + _loadingIndicator.hidesWhenStopped = YES; + _loadingIndicator.userInteractionEnabled = YES; + } + return _loadingIndicator; +} + +@end diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/MSRoomMenuGameVC.m b/YuMi/Modules/YMRoom/View/MenuContainerView/MSRoomMenuGameVC.m index 2db4584e..d13bd7ca 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/MSRoomMenuGameVC.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/MSRoomMenuGameVC.m @@ -19,10 +19,12 @@ #import "GuildSuperAdminInfoModel.h" #import "XPRoomPKViewController.h" #import "XPAcrossRoomPKViewController.h" - +#import "LuckyPackageViewController.h" +#import "XCCurrentVCStackManager.h" #import #import "Api+LittleGame.h" #import "Api+RoomSetting.h" +#import "UserInfoModel.h" @interface MSRoomMenuGameVC () @property(nonatomic,strong) MSRoomMenuGameView *gameView; @@ -247,7 +249,15 @@ } - (void)handleActivityInfo:(ActivityInfoModel *)model { - if ([model.code isEqualToString:@"FIND_LOVE"]) { + if ([model.code isEqualToString:@"LUCKY_BAG"]) { + if ([[self.hostDelegate getUserInfo] isRechargeUser]) { + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"1.0.37_text_52")]; + return; + } + LuckyPackageViewController *giftVC = [[LuckyPackageViewController alloc] initWithdelegate:self.hostDelegate]; + [[XCCurrentVCStackManager shareManager].getCurrentVC addChildViewController:giftVC]; + [[XCCurrentVCStackManager shareManager].getCurrentVC.view addSubview:giftVC.view]; + } else if ([model.code isEqualToString:@"FIND_LOVE"]) { [self lookLoveTapRecognizer]; } else if([model.code isEqualToString:@"NAUTICAL_ADVENTURE"]) { [self sailTapRecognizer]; diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m index f487888b..c22223ad 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomMenuContainerView.m @@ -630,23 +630,30 @@ UIKIT_EXTERN NSString * kRoomBackMusicCaptureVolumeKey; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_Arrange_Mic || attachment.first == CustomMessageType_Room_PK) { - if (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Arrange_Mic_Empty || attachment.second == Custom_Message_Sub_Room_PK_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty) { - NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; - request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId]; - request.userIds = @[[AccountInfoStorage instance].getUid]; - @kWeakify(self); - [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { - @kStrongify(self); - NIMChatroomMember * member; - if (error == nil) { - member = members.firstObject; + switch (attachment.first) { + case CustomMessageType_Arrange_Mic: { + if (attachment.first == CustomMessageType_Room_PK) { + if (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Arrange_Mic_Empty || attachment.second == Custom_Message_Sub_Room_PK_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty) { + NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; + request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId]; + request.userIds = @[[AccountInfoStorage instance].getUid]; + @kWeakify(self); + [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { + @kStrongify(self); + NIMChatroomMember * member; + if (error == nil) { + member = members.firstObject; + } + if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) { + self.arrangeMicButton.selected = (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty); + }; + }]; } - if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) { - self.arrangeMicButton.selected = (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty); - }; - }]; + } } + break; + default: + break; } } diff --git a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m index 84072dda..9f80b87b 100644 --- a/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m +++ b/YuMi/Modules/YMRoom/View/MenuContainerView/XPRoomSendTextView.m @@ -20,18 +20,22 @@ #import "UserInfoModel.h" #import "RoomInfoModel.h" #import "ClientConfig.h" + +#import "Api+Message.h" +#import "UploadFile.h" +#import "TZImagePickerController.h" //公屏限制最大字数 #define MAX_STARWORDS_LENGTH 300 -@interface XPRoomSendTextView () +@interface XPRoomSendTextView () ///输入框 @property (nonatomic, strong) MSBaseTextField *editTextFiled; @property (nonatomic, strong) UIView *bgEditTextFiled; ///发送按钮 @property (nonatomic, strong) UIButton *sendButton; -///上头像 -@property(nonatomic,strong) UIButton *headlineBtn; +///发图片 +@property(nonatomic, strong) UIButton *imageButton; ///文本输入的内容 @property (nonatomic,copy) NSString *inputMessage; ///代理 @@ -66,6 +70,95 @@ } +- (void)didTapImageButton { + UserVipInfoVo *vipVO = [[self.delegate getUserInfo] userVipInfoVO]; + if (!vipVO || vipVO.roomPicScreen == NO) { + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"1.0.37_text_33")]; + return; + } + + // TODO: 选中图片 -> 上传图片 -> call API + TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:self]; + imagePickerVc.modalPresentationStyle = UIModalPresentationOverFullScreen; + imagePickerVc.allowPickingVideo = NO; + imagePickerVc.allowTakeVideo = NO; + imagePickerVc.maxImagesCount = 1; + imagePickerVc.naviBgColor = [DJDKMIMOMColor appCellBackgroundColor]; + imagePickerVc.naviTitleColor = [DJDKMIMOMColor mainTextColor]; + imagePickerVc.barItemTextColor = [DJDKMIMOMColor mainTextColor]; + [self.delegate.getCurrentNav presentViewController:imagePickerVc animated:YES completion:nil]; +} + +#pragma mark - TZImagePickerControllerDelegate +- (void)imagePickerController:(TZImagePickerController *)picker + didFinishPickingPhotos:(NSArray *)photos + sourceAssets:(NSArray *)assets + isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto + infos:(NSArray *)infos { + + [self.editTextFiled resignFirstResponder]; + + [XNDJTDDLoadingTool showOnlyView:kWindow enabled:YES]; + + [self uploadAlbumPicList:photos finish:^(NSArray *list) { + [XNDJTDDLoadingTool hideHUD]; + NSDictionary *dic = [list xpSafeObjectAtIndex:0]; + NSString *picUrl = [dic objectForKey:@"resUrl"]; + if ([NSString isEmpty:picUrl]) { + return; + } + [Api sendRoomImageMessage:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + + } else { + [XNDJTDDLoadingTool showErrorWithMessage:msg]; + } + } picUrl:picUrl roomUid:[self.delegate.getRoomInfo uid]]; + }]; +} + +///上传图片 +- (void)uploadAlbumPicList:(NSArray *)array + finish:(void(^)(NSArray *list))finish { + dispatch_semaphore_t semaphore = dispatch_semaphore_create(1); + dispatch_queue_t queue = dispatch_get_global_queue(0, 0); + NSMutableArray * dataArray = [NSMutableArray array]; + __block NSInteger imageCount = 0; + dispatch_async(queue, ^{ + for (UIImage * image in array) { + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + NSData *data = UIImageJPEGRepresentation(image, 0.5); + NSString *format = [UIImage getImageTypeWithImageData:data]; + NSString *name = [NSString stringWithFormat:@"image/%@.%@",[NSString createUUID],format]; + [[UploadFile share]QCloudUploadImage:data named:name success:^(NSString * _Nonnull key, NSDictionary * _Nonnull resp) { + dispatch_semaphore_signal(semaphore); + imageCount ++; + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + if (image.size.width > 0){ + [dict safeSetObject:@(image.size.width) forKey:@"width"]; + } + if (image.size.height){ + [dict safeSetObject:@(image.size.height) forKey:@"height"]; + } + if (key.length > 0) { + [dict safeSetObject:key forKey:@"resUrl"]; + } + [dict safeSetObject:format forKey:@"format"]; + [dataArray addObject:dict]; + if (imageCount == array.count) { + dispatch_async(dispatch_get_main_queue(), ^{ + finish(dataArray); + }); + } + } failure:^(NSNumber * _Nonnull resCode, NSString * _Nonnull message) { + imageCount ++; + dispatch_semaphore_signal(semaphore); + [XNDJTDDLoadingTool showErrorWithMessage:message]; + }]; + } + }); +} + #pragma mark - Response - (void)sendButtonDidClick:(UIButton *)sender { @@ -119,8 +212,7 @@ [remoteExt setObject:nickStr forKey:@"atNames"]; } message.remoteExt = remoteExt; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[userInfo.partitionId]]; - NSString * sessionId = [self.delegate getPublicScreenType] == 0 ? [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]:publicChatRoomId; + NSString *sessionId = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].roomId]; //构造会话 self.sendButton.enabled = NO; NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; @@ -228,31 +320,16 @@ textView = [[XPRoomSendTextView alloc] initWithDelegate:delegate]; [view addSubview:textView]; }else{ - UIButton *headlineBtn = [textView viewWithTag:100]; UIButton *sendButton = [textView viewWithTag:101]; - if(delegate.getPublicScreenType == 0){ - headlineBtn.hidden = YES; - [sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(58); - make.height.mas_equalTo(29); - make.trailing.mas_equalTo(-15); - make.centerY.equalTo(textView); - }]; - - }else{ - [sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(58); - make.height.mas_equalTo(29); - make.trailing.mas_equalTo(-53); - make.centerY.equalTo(textView); - }]; - headlineBtn.hidden = NO; - } - + [sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(58); + make.height.mas_equalTo(29); + make.trailing.mas_equalTo(-15); + make.centerY.equalTo(textView); + }]; } textView.hidden = NO; - [textView mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.bottom.mas_equalTo(view); make.height.mas_equalTo(60); @@ -274,20 +351,11 @@ [self addSubview:self.bgEditTextFiled]; [self.bgEditTextFiled addSubview:self.editTextFiled]; [self addSubview:self.sendButton]; - [self addSubview:self.headlineBtn]; + [self addSubview:self.imageButton]; } - (void)initSubViewConstraints { - - [self.headlineBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(50); - make.height.mas_equalTo(45); - make.trailing.mas_equalTo(0); - make.centerY.equalTo(self); - }]; - - [self.bgEditTextFiled mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.mas_equalTo(6); make.height.mas_equalTo(36); @@ -301,23 +369,18 @@ make.top.bottom.mas_equalTo(0); }]; - if(self.delegate.getPublicScreenType == 0){ - self.headlineBtn.hidden = YES; - [self.sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(58); - make.height.mas_equalTo(29); - make.trailing.mas_equalTo(-15); - make.centerY.equalTo(self); - }]; - return; - } + [self.imageButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.editTextFiled); + make.size.mas_equalTo(CGSizeMake(26, 26)); + make.trailing.mas_equalTo(self.editTextFiled);//.offset(-10); + }]; + [self.sendButton mas_remakeConstraints:^(MASConstraintMaker *make) { make.width.mas_equalTo(58); make.height.mas_equalTo(29); - make.trailing.mas_equalTo(-53); + make.trailing.mas_equalTo(-15); make.centerY.equalTo(self); }]; - self.headlineBtn.hidden = NO; } - (void)addNotification { @@ -325,14 +388,15 @@ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(textFieldEditChanged:) name:UITextFieldTextDidChangeNotification object:self.editTextFiled]; } + -(void)showInputView:(NSString *)text{ self.editTextFiled.text = text; self.inputMessage = text; if(text.length > 0){ - self.sendButton.enabled = YES; + self.sendButton.enabled = YES; } - } + #pragma mark - Getters And Setters - (MSBaseTextField *)editTextFiled{ if (!_editTextFiled) { @@ -364,8 +428,6 @@ return _sendButton; } - - - (NSMutableArray *)atNames { if (!_atNames) { _atNames = [NSMutableArray array]; @@ -379,14 +441,13 @@ } return _atUids; } -- (UIButton *)headlineBtn{ - if(!_headlineBtn){ - _headlineBtn = [UIButton new]; - [_headlineBtn setBackgroundImage:[UIImage getLanguageImage:@"ms_room_message_send_headline_icon"] forState:UIControlStateNormal]; - [_headlineBtn addTarget:self action:@selector(showSendheadlineBtnAction) forControlEvents:UIControlEventTouchUpInside]; - _headlineBtn.tag = 100; +- (UIButton *)imageButton{ + if(!_imageButton){ + _imageButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_imageButton setBackgroundImage:kImage(@"send_image_icon") forState:UIControlStateNormal]; + [_imageButton addTarget:self action:@selector(didTapImageButton) forControlEvents:UIControlEventTouchUpInside]; } - return _headlineBtn; + return _imageButton; } - (UIView *)bgEditTextFiled{ if(!_bgEditTextFiled){ diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Model/XPMessageInfoModel.h b/YuMi/Modules/YMRoom/View/MessageContainerView/Model/XPMessageInfoModel.h index 81160e2d..5519235c 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Model/XPMessageInfoModel.h +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Model/XPMessageInfoModel.h @@ -17,6 +17,7 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,strong) NSString *charmUrl; @property(nonatomic,strong) NSString *experUrl; @property(nonatomic,assign) int first; +@property(nonatomic,assign) int second; @property(nonatomic,copy) NSString *nameText; ///显示文本 @property (nonatomic,strong) NSAttributedString *content; @@ -46,6 +47,8 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic, copy) NSString *cellKey; +@property(nonatomic, strong) NSDictionary *customInfo; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m index 66913280..e4c6ce21 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/MsRoomMessageMainView.m @@ -112,36 +112,21 @@ #pragma mark - RoomGuestDelegate - (void)handleNIMCustomMessage:(NIMMessage *)message { - UserInfoModel *infoModel = self.hostDelegate.getUserInfo; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; - if(![message.session.sessionId isEqualToString:publicChatRoomId]){ - [self.messageListView handleNIMCustomMessage:message]; - return; - } + [self.messageListView handleNIMCustomMessage:message]; } - (void)handleNIMNotificationMessage:(NIMMessage *)message { - UserInfoModel *infoModel = self.hostDelegate.getUserInfo; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; - if(![message.session.sessionId isEqualToString:publicChatRoomId]){ - [self.messageListView handleNIMNotificationMessage:message]; - return; - } + [self.messageListView handleNIMNotificationMessage:message]; } - (void)handleNIMTextMessage:(NIMMessage *)message { - UserInfoModel *infoModel = self.hostDelegate.getUserInfo; - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[infoModel.partitionId]]; - if(![message.session.sessionId isEqualToString:publicChatRoomId]){ - [self.messageListView handleNIMTextMessage:message]; - return; - } + [self.messageListView handleNIMTextMessage:message]; } - (void)handleNIMImageMessage:(NIMMessage *)message { + } - - (void)onRoomMiniEntered { self.hidden = NO; [self.messageListView onRoomMiniEntered]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m index a2fb287c..db86e411 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -149,6 +149,7 @@ XPMessageRemoteExtModel * model = [XPMessageRemoteExtModel modelWithJSON:message.remoteExt[message.from]]; messageInfo.bubbleImageUrl = [self parseMessageBubble:message]; int first = attachment.first; + int second = attachment.second; if (first == CustomMessageType_Gift) {///单人送 return [self createSendGiftAttribute:attachment sendInfo:model messageInfo:messageInfo]; } else if(first == CustomMessageType_AllMicroSend) {///全麦送 多人送 @@ -184,8 +185,12 @@ return [self createRoomGiftCompoundAttribute:attachment messageInfo:messageInfo]; } else if(first == CustomMessageType_Room_Sailing) {///航海 return [self createRoomSailingAttribute:attachment messageInfo:messageInfo]; - } else if (first == CustomMessageType_RedPacket && attachment.second == Custom_Message_Sub_OpenRedPacketSuccess) { - return [self createRedPacketAttribute:attachment messageInfo:messageInfo]; + } else if (first == CustomMessageType_RedPacket) { + if (attachment.second == Custom_Message_Sub_OpenRedPacketSuccess) { + return [self createRedPacketAttribute:attachment messageInfo:messageInfo]; + } else if (attachment.second == Custom_Message_Sub_LuckyPackage){ + return [self createNewRedPacketAttribute:attachment messageInfo:messageInfo]; + } } else if (first == CustomMessageType_Treasure_Fairy) { return [self createTreasureFairyAttribute:attachment messageInfo:messageInfo]; }else if (first == CustomMessageType_Room_Album) { @@ -209,6 +214,8 @@ messageInfo.first = CustomMessageType_Room_Album; messageInfo.nameText = nick; messageInfo.albumModel = albumModel; + messageInfo.content = [self makeUserNameAttribute:message messageInfo:messageInfo]; + messageInfo.rowHeight = 240; return messageInfo; }else if(first == CustomMessageType_Guardian_Planet){ return [self createGuardianPlanetAttribute:attachment messageInfo:messageInfo]; @@ -289,11 +296,92 @@ return messageInfo; } + } else if (first == CustomMessageType_User_Enter_Room) { + switch (second) { + case Custom_Message_Sub_User_Enter_Room: + return [self createCPEnterRoomAttribute:attachment messageInfo:messageInfo]; + break; + case Custom_Message_Sub_Pic_Message: { + PIRoomPhotoAlbumItemModel *albumModel = [PIRoomPhotoAlbumItemModel modelWithDictionary:attachment.data]; + albumModel.photoUrl = albumModel.picUrl; + albumModel.type = @"1"; + albumModel.status = 1; + + messageInfo.first = CustomMessageType_Room_Album; + messageInfo.nameText = albumModel.nick; + messageInfo.albumModel = albumModel; + messageInfo.charmUrl = albumModel.charmUrl; + messageInfo.experUrl = albumModel.experUrl; + messageInfo.bubbleImageUrl = albumModel.iosBubbleUrl; + messageInfo.vipIcon = albumModel.vipIcon; + messageInfo.content = [self makeUserNameAttribute:message messageInfo:messageInfo]; + messageInfo.rowHeight = 240; + return messageInfo; + } + break; + default: + break; + } } return nil; } +- (NSAttributedString *)makeUserNameAttribute:(NIMMessage *)message + messageInfo:(XPMessageInfoModel *)messageInfo { + NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init]; + + NSString *nick = messageInfo.albumModel.nick; + if ([NSString isEmpty:nick]) { + nick = messageInfo.nameText; + } + + NSString *experUrl = messageInfo.albumModel.experUrl; + if ([NSString isEmpty:experUrl]) { + experUrl = messageInfo.experUrl; + } + + NSString *charmUrl = messageInfo.albumModel.charmUrl; + if ([NSString isEmpty:charmUrl]) { + charmUrl = messageInfo.charmUrl; + } + + NSString *vipIcon = messageInfo.albumModel.vipIcon; + if ([NSString isEmpty:vipIcon]) { + vipIcon = messageInfo.vipIcon; + } + + NSString *inRoomNameplatePic = messageInfo.albumModel.inRoomNameplatePic; + + ///官方新用户 + [attribute appendAttributedString:[self createOfficalAndNewuserAttribute:messageInfo.albumModel.defUser + newUser:messageInfo.albumModel.newUser + fromSayHelloChannel:NO]]; + if ([self isCurrentRoomSuperAdmin:message.from]) { + [attribute appendAttributedString:[self createLanguageImageAttribute:@"common_super_admin"]]; + } + if (![NSString isEmpty:experUrl]) { + [attribute appendAttributedString:[self createUrlImageAttribute:experUrl]]; + [attribute appendAttributedString:[self createSapceAttribute:2]]; + } + if (![NSString isEmpty:charmUrl]) {//等级 + [attribute appendAttributedString:[self createUrlImageAttribute:charmUrl]]; + [attribute appendAttributedString:[self createSapceAttribute:2]]; + } + if (![NSString isEmpty:vipIcon]) { + [attribute appendAttributedString:[self createUrlImageAttribute:vipIcon]]; + [attribute appendAttributedString:[self createSapceAttribute:2]]; + } + if (![NSString isEmpty:inRoomNameplatePic]) { + [attribute appendAttributedString:[self createUrlImageAttribute:inRoomNameplatePic]]; + [attribute appendAttributedString:[self createSapceAttribute:2]]; + } + + [attribute appendAttributedString:[self createTextAttribute:nick color:[UIColor colorWithWhite:1 alpha:0.7] font:kRoomMessageDefalutFont]]; + [attribute appendAttributedString:[self createSapceAttribute:2]]; + return attribute.copy; +} + /// @param message 消息的实体 - (XPMessageInfoModel*)makeChatAttribute:(NIMMessage *)message messageInfo:(XPMessageInfoModel *)messageInfo{ @@ -680,6 +768,28 @@ return messageInfo; } +- (XPMessageInfoModel *)createNewRedPacketAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{ + NSDictionary *dic = attachment.data; + if (dic) { + messageInfo.customInfo = dic; + } + messageInfo.rowHeight = 100; + messageInfo.first = attachment.first; + messageInfo.second = attachment.second; + return messageInfo; +} + +#pragma mark - CP 进场 +- (XPMessageInfoModel *)createCPEnterRoomAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{ + NSMutableDictionary *dic = [attachment.data mutableCopy]; + [dic setObject:@(attachment.seq) forKey:@"cpIndex"]; + messageInfo.customInfo = dic.copy; + messageInfo.rowHeight = 81; + messageInfo.first = attachment.first; + messageInfo.second = attachment.second; + return messageInfo; +} + #pragma mark - 航海 - (XPMessageInfoModel *)createRoomSailingAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{ RoomSailingPrizeModel *info = [RoomSailingPrizeModel modelWithDictionary:attachment.data]; @@ -1291,11 +1401,14 @@ if (giftInfo == nil) { giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:info.giftId]; } + if (giftInfo == nil) { + giftInfo = [info.displayGift xpSafeObjectAtIndex:0]; + } ///官方新用户 [attribute appendAttributedString:[self createOfficalAndNewuserAttribute:sendInfo.defUser newUser:sendInfo.newUser fromSayHelloChannel:sendInfo.fromSayHelloChannel]]; //nick [attribute appendAttributedString:[self createNickAtrribute:info.nick uid:info.uid.integerValue]]; - [attribute appendAttributedString:[self createSapceAttribute:2]];; + [attribute appendAttributedString:[self createSapceAttribute:2]]; if (attachment.second == Custom_Message_Sub_Gift_LuckySend) { //action [attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser106") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; @@ -1310,6 +1423,9 @@ [attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser108") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [info.luckyGiftList.giftList enumerateObjectsUsingBlock:^(GiftListsInfo * _Nonnull giftListInfo, NSUInteger idx, BOOL * _Nonnull stop) { GiftInfoModel *luckyGiftInfo = [[XPGiftStorage shareStorage] findGiftInfo:[NSString stringWithFormat:@"%ld", giftListInfo.giftId]]; + if (luckyGiftInfo == nil) { + luckyGiftInfo = giftInfo; + } // 价值 [attribute appendAttributedString: [self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser109") color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; [attribute appendAttributedString:[self createSapceAttribute:2]]; @@ -1321,7 +1437,7 @@ [attribute appendAttributedString:[self createUrlImageAttribute:luckyGiftInfo.giftUrl]]; [attribute appendAttributedString:[self createSapceAttribute:2]]; //x N - [attribute appendAttributedString:[self createTextAttribute: [NSString stringWithFormat:@" X%ld",giftListInfo.giftNum] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]]; + [attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@" X%ld",giftListInfo.giftNum] color:[DJDKMIMOMColor messageTextColor] font:kRoomMessageDefalutFont]]; if (info.luckyGiftList.giftList.count-1 != idx) { //, [attribute appendAttributedString: [self createTextAttribute:@"," color:[DJDKMIMOMColor messageDefaultTextColor] font:kRoomMessageDefalutFont]]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumCell.m b/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumCell.m index 95c82782..d6ed34a7 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumCell.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumCell.m @@ -15,6 +15,7 @@ #import "ThemeColor+Room.h" #import "UIImage+Utils.h" #import "XPMessageInfoModel.h" +#import "XPNetImageYYLabel.h" #import "PIRoomMessagePhotoAlbumView.h" #import "XPRoomMessageConstant.h" @@ -23,11 +24,8 @@ ///气泡 @property (nonatomic,strong) NetImageView *bubbleImageView; ///昵称 -@property(nonatomic,strong) UILabel *nameView; -///魅力 -@property (nonatomic,strong) NetImageView *charmView; -///财富 -@property (nonatomic,strong) NetImageView *wealthView; +@property(nonatomic,strong) XPNetImageYYLabel *nameView; + ///解锁的图片 @property(nonatomic,strong) PIRoomMessagePhotoAlbumView *unlockPhotoView; ///点击空白区域的手势 @@ -58,13 +56,10 @@ self.backgroundColor = [UIColor clearColor]; [self.contentView addSubview:self.bubbleImageView]; - [self.contentView addSubview:self.wealthView]; - [self.contentView addSubview:self.charmView]; [self.contentView addSubview:self.nameView]; - [self.contentView addSubview:self.loopUserCardBtn]; +// [self.contentView addSubview:self.loopUserCardBtn]; [self.contentView addSubview:self.unlockPhotoView]; - UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTap)]; tap.delegate = self; self.tapEmptyRecognizer = tap; @@ -83,38 +78,21 @@ } -(void)installConstraints{ [self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.top.mas_equalTo(self.contentView); + make.leading.top.trailing.mas_equalTo(self.contentView); make.bottom.mas_equalTo(self.contentView).offset(-6); - make.width.mas_equalTo(162); - make.height.mas_equalTo(180); - }]; - [self.wealthView mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(36); - make.height.mas_equalTo(18); - make.top.mas_equalTo(6); - make.leading.mas_equalTo(self.bubbleImageView).offset(12); - }]; - [self.charmView mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_equalTo(36); - make.height.mas_equalTo(18); - make.top.mas_equalTo(6); - make.leading.mas_equalTo(self.bubbleImageView).offset(49); }]; + [self.nameView mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.mas_equalTo(self.bubbleImageView).offset(89); - make.trailing.mas_equalTo(self.bubbleImageView.mas_trailing).offset(-12); - make.height.mas_equalTo(17); - make.centerY.equalTo(self.wealthView); - }]; - [self.loopUserCardBtn mas_makeConstraints:^(MASConstraintMaker *make) { - make.leading.top.bottom.equalTo(self.charmView); - make.trailing.equalTo(self.nameView.mas_trailing); + make.top.mas_equalTo(self.bubbleImageView).offset(8); + make.leading.mas_equalTo(self.bubbleImageView).offset(8); + make.trailing.mas_equalTo(self.bubbleImageView).offset(-12); }]; + [self.unlockPhotoView mas_makeConstraints:^(MASConstraintMaker *make) { - make.top.equalTo(self.nameView.mas_bottom).mas_offset(5); - make.leading.equalTo(self.bubbleImageView).inset(12); - make.width.mas_equalTo(138); - make.height.mas_equalTo(140); + make.top.mas_equalTo(self.bubbleImageView).offset(37); + make.bottom.mas_equalTo(self.bubbleImageView).offset(-6); + make.leading.mas_equalTo(self.bubbleImageView).inset(12); + make.width.mas_equalTo(self.unlockPhotoView.mas_height); }]; } @@ -180,12 +158,14 @@ albumModel.status = 0; } - self.charmView.imageUrl = _messageInfo.charmUrl; - self.wealthView.imageUrl = _messageInfo.experUrl; - self.albumModel = albumModel; self.unlockPhotoView.albumModel = albumModel; - self.nameView.text = _messageInfo.nameText; + if ([NSString isEmpty:messageInfo.content.string]) { + self.nameView.text = _messageInfo.nameText; + } else { + self.nameView.attributedText = _messageInfo.content; + } + if (_messageInfo.bubbleImageUrl.length) { [self.bubbleImageView loadImageWithUrl:_messageInfo.bubbleImageUrl completion:^(UIImage * _Nonnull image, NSURL * _Nonnull url) { UIImage *image1 = [UIImage imageWithCGImage:image.CGImage scale:2.0 orientation:UIImageOrientationUp]; @@ -233,40 +213,23 @@ return _bubbleImageView; } -- (UILabel *)nameView { +- (XPNetImageYYLabel *)nameView { if (!_nameView) { - _nameView = [[UILabel alloc] init]; - _nameView.numberOfLines = 1; + _nameView = [[XPNetImageYYLabel alloc] init]; + _nameView.preferredMaxLayoutWidth = kRoomMessageMaxWidth; + _nameView.numberOfLines = 0; _nameView.userInteractionEnabled = YES; - _nameView.textColor = [UIColor colorWithWhite:1 alpha:0.4]; - _nameView.font = [UIFont systemFontOfSize:12 weight:UIFontWeightRegular]; + @kWeakify(self); + [_nameView setUpdateLayoutSize:^(CGSize size) { + @kStrongify(self); + [self.unlockPhotoView mas_updateConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.bubbleImageView).offset(16 + size.height); + }]; + }]; } return _nameView; } -- (NetImageView *)charmView{ - if(!_charmView){ - NetImageConfig *config = [[NetImageConfig alloc]init]; - config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; - _charmView = [[NetImageView alloc]initWithConfig:config]; - _charmView.layer.cornerRadius = 9; - _charmView.layer.masksToBounds = YES; - - - _charmView.contentMode = UIViewContentModeScaleAspectFill; - } - return _charmView; -} -- (NetImageView *)wealthView{ - if(!_wealthView){ - NetImageConfig *config = [[NetImageConfig alloc]init]; - config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; - _wealthView = [[NetImageView alloc]initWithConfig:config]; - _wealthView.layer.cornerRadius = 9; - _wealthView.layer.masksToBounds = YES; - _wealthView.contentMode = UIViewContentModeScaleAspectFill; - } - return _wealthView; -} + - (PIRoomMessagePhotoAlbumView *)unlockPhotoView{ if(!_unlockPhotoView){ _unlockPhotoView = [[PIRoomMessagePhotoAlbumView alloc]initWithFrame:CGRectZero]; @@ -281,15 +244,9 @@ } return _loopUserCardBtn; } -- (void)awakeFromNib { - [super awakeFromNib]; - // Initialization code -} - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; - - // Configure the view for the selected state } @end diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumView.m index 3764dfb1..5f1e7d39 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/View/PIRoomMessagePhotoAlbumView.m @@ -142,7 +142,7 @@ NetImageConfig *config = [[NetImageConfig alloc]init]; config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; _unlockPhotoView = [[NetImageView alloc]initWithConfig:config]; - [_unlockPhotoView setCornerWithLeftTopCorner:kGetScaleWidth(8) rightTopCorner:kGetScaleWidth(8) bottomLeftCorner:kGetScaleWidth(8) bottomRightCorner:kGetScaleWidth(8) size:CGSizeMake(138, 140)]; + [_unlockPhotoView setCornerRadius:8]; _unlockPhotoView.userInteractionEnabled = YES; _unlockPhotoView.contentMode = UIViewContentModeScaleAspectFill; UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(lookUpPhoto)]; diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m index 131f42d4..2a5db192 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/XPRoomMessageContainerView.m @@ -48,6 +48,14 @@ // Boom #import "BoomInfoModel.h" +// 红包 +#import "LuckyPackageMessageTableViewCell.h" + +// CP 进场提示 +#import "CPEnterRoomTableViewCell.h" + +#import "RoomEnterModel.h" + NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; @interface XPRoomMessageContainerView () @@ -82,6 +90,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; @property(nonatomic,assign) BOOL isLoadHistoryMessage; @property (nonatomic, assign) NSInteger displayType; + @end @@ -415,21 +424,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; - (void)addRoomMessage:(id)messageData { if(self.isLoadHistoryMessage == YES)return; [self.incomingMessages addObject:messageData]; - - NSInteger messageCount = 0; - switch (self.displayType) { - case 1: - messageCount = self.datasource.count; - break; - case 2: - messageCount = self.datasource_chat.count; - break; - case 3: - messageCount = self.datasource_gift.count; - break; - default: - break; - } + if ([messageData isKindOfClass:[NIMBroadcastMessage class]]) { NIMBroadcastMessage *broadcastMessage = (NIMBroadcastMessage *)messageData; [[XPRoomMiniManager shareManager] saveRoomMessage:broadcastMessage]; @@ -530,7 +525,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_Face && attachment.second == Custom_Message_Sub_Face_Send) { + if (attachment.first == CustomMessageType_User_Enter_Room && attachment.second == Custom_Message_Sub_User_Enter_Room) { + return NO; + } + if (attachment.first == CustomMessageType_RedPacket) { + return NO; + } else if (attachment.first == CustomMessageType_Face && attachment.second == Custom_Message_Sub_Face_Send) { if ([attachment.data[@"data"] isKindOfClass:[NSArray class]]) { NSArray * array = [RoomFaceSendInfoModel modelsWithArray:attachment.data[@"data"]]; for (int i = 0; i< array.count; i++) { @@ -563,7 +563,6 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; if(isRoomAlbum == YES){ return NO; } - } GiftReceiveInfoModel *info = [GiftReceiveInfoModel modelWithJSON:attachment.data]; GiftInfoModel *giftInfo = info.gift == nil ? info.giftInfo : info.gift; @@ -701,6 +700,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; @(CustomMessageType_RedPacket): [NSSet setWithObjects: @(Custom_Message_Sub_OpenRedPacketSuccess), + @(Custom_Message_Sub_LuckyPackage), nil], @(CustomMessageType_Treasure_Fairy): [NSSet setWithObjects: @@ -814,83 +814,100 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; - (void)handleNIMCustomMessage:(NIMMessage *)message { self.isMiniEnter = NO; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; + if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_Update_RoomInfo && - attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) { - [self.datasource removeAllObjects]; - [self updateAllDataSource:nil]; - [self.incomingMessages removeAllObjects]; - [self.locationArray removeAllObjects]; - self.atCount = 0; - self.atTipBtn.hidden = YES; - self.messageTipsBtn.hidden = YES; - self.isPending = NO; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [self addRoomMessage:message]; - return; - } else if (attachment.first == CustomMessageType_Update_RoomInfo && - attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) { - [self.datasource removeAllObjects]; - [self updateAllDataSource:nil]; - [self.incomingMessages removeAllObjects]; - [self.locationArray removeAllObjects]; - self.atCount = 0; - self.atTipBtn.hidden = YES; - self.messageTipsBtn.hidden = YES; - self.isPending = NO; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [self addRoomMessage:message]; - return; - } else if(attachment.first == CustomMessageType_Candy_Tree && - attachment.second == Custom_Message_Sub_Candy_Tree_Me) { - CandyTreeGiftInfoModel * model = [CandyTreeGiftInfoModel modelWithDictionary:attachment.data]; - if (model.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) { - return; - } - } else if (attachment.first == CustomMessageType_Kick_User) { - NSString * uid = [AccountInfoStorage instance].getUid; - NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]; - NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; - request.roomId = roomId; - request.userIds = @[uid]; - [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { - if (error == nil) { - NIMChatroomMember * member = members.firstObject; - BOOL isCreator = member.type == NIMChatroomMemberTypeCreator; - BOOL isManager = member.type == NIMChatroomMemberTypeManager; - if (isCreator || isManager) { + switch (attachment.first) { + case CustomMessageType_Update_RoomInfo: { + if (attachment.second == Custom_Message_Sub_Update_RoomInfo_MessageState) { + [self.datasource removeAllObjects]; + [self updateAllDataSource:nil]; + [self.incomingMessages removeAllObjects]; + [self.locationArray removeAllObjects]; + self.atCount = 0; + self.atTipBtn.hidden = YES; + self.messageTipsBtn.hidden = YES; + self.isPending = NO; + [[XPRoomMiniManager shareManager] resetLocalMessage]; + [self addRoomMessage:message]; + } else if (attachment.second == Custom_Message_Sub_Update_RoomInfo_CleanScreen) { + [self.datasource removeAllObjects]; + [self updateAllDataSource:nil]; + [self.incomingMessages removeAllObjects]; + [self.locationArray removeAllObjects]; + self.atCount = 0; + self.atTipBtn.hidden = YES; + self.messageTipsBtn.hidden = YES; + self.isPending = NO; + [[XPRoomMiniManager shareManager] resetLocalMessage]; + [self addRoomMessage:message]; + } + } + break; + case CustomMessageType_Candy_Tree: { + if(attachment.second == Custom_Message_Sub_Candy_Tree_Me) { + CandyTreeGiftInfoModel * model = [CandyTreeGiftInfoModel modelWithDictionary:attachment.data]; + if (model.uid.integerValue != [AccountInfoStorage instance].getUid.integerValue) { + return; + } + } + } + break; + case CustomMessageType_Kick_User: { + NSString * uid = [AccountInfoStorage instance].getUid; + NSString * roomId = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId]; + NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; + request.roomId = roomId; + request.userIds = @[uid]; + [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { + if (error == nil) { + NIMChatroomMember * member = members.firstObject; + BOOL isCreator = member.type == NIMChatroomMemberTypeCreator; + BOOL isManager = member.type == NIMChatroomMemberTypeManager; + if (isCreator || isManager) { + [self addRoomMessage:message]; + } + } + }]; + } + break; + case CustomMessageType_Hall_Super_Admin: { + [self addRoomMessage:message]; + } + break; + case CustomMessageType_RedPacket: { + NSDictionary *data = attachment.data; + if (data) { + NSInteger currentRoomUID = self.hostDelegate.getRoomInfo.uid; + NSNumber *messageRoomUI = [data objectForKey:@"roomUid"]; + if (messageRoomUI) { + if (currentRoomUID == messageRoomUI.integerValue) { + [self addRoomMessage:message]; + } + } + } + } + break; + case CustomMessageType_User_Enter_Room: { + if (attachment.second == Custom_Message_Sub_Pic_Message) { + [self addRoomMessage:message]; + } else if (attachment.second == Custom_Message_Sub_User_Enter_Room) { + RoomEnterModel *model = [RoomEnterModel modelWithJSON:attachment.data]; + if (model.screenType == 1 || model.enterHide == 1) { + return; + } + NSInteger index = 0; + for (RoomEnterCPListModel *cp in model.cpList) { + attachment.seq = index; + index += 1; + [(NIMCustomObject *)message.messageObject setAttachment:attachment]; [self addRoomMessage:message]; } } - }]; - return; - } else if (attachment.first == CustomMessageType_Hall_Super_Admin) { - [self addRoomMessage:message]; -// switch (attachment.second) { -// -// case Custom_Message_Sub_Hall_Super_Admin_Lock_Mic: { -// [self addRoomMessage:message]; -// } -// break; -// case Custom_Message_Sub_Hall_Super_Admin_Mute_Mic: -// [self addRoomMessage:message]; -// break; -// case Custom_Message_Sub_Hall_Super_Admin_Kick_Down_Mic: -// -// break; -// case Custom_Message_Sub_Hall_Super_Admin_Mark_Black: -// -// break; -// case Custom_Message_Sub_Hall_Super_Admin_Kick_Out_Room: -// -// break; -// case Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room: -// -// break; -// default: -// break; -// } + } + break; + default: + break; } } if (self.hostDelegate.getRoomInfo.isCloseScreen) { @@ -1082,8 +1099,9 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; AttachmentModel *attachment = (AttachmentModel *)obj.attachment; if (attachment.first == CustomMessageType_Room_Album && attachment.second == Custom_Message_Sub_Room_Album) { isHaveSave = YES; + } else if (attachment.first == CustomMessageType_User_Enter_Room && attachment.second == Custom_Message_Sub_Pic_Message) { + isHaveSave = YES; } - } } if(isHaveSave == NO)return; @@ -1277,12 +1295,22 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; } XPMessageInfoModel *model = [source xpSafeObjectAtIndex:indexPath.row]; NSString *cellKey = [NSString isEmpty:model.cellKey] ? NSStringFromClass([XPRoomMessageTableViewCell class]) : model.cellKey; - if(model.first == CustomMessageType_Room_Album){ + if(model.first == CustomMessageType_Room_Album || + (model.first == CustomMessageType_User_Enter_Room && model.second == Custom_Message_Sub_Pic_Message)){ PIRoomMessagePhotoAlbumCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])]; cell.delegate = self; cell.messageInfo = model; cell.roomType = self.hostDelegate.getRoomInfo.type; return cell; + } else if (model.first == CustomMessageType_RedPacket && model.second == Custom_Message_Sub_LuckyPackage) { + LuckyPackageMessageTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"LuckyPackageMessageTableViewCell" forIndexPath:indexPath]; + cell.dataSource = model.customInfo; + return cell; + } else if (model.first == CustomMessageType_User_Enter_Room && model.second == Custom_Message_Sub_User_Enter_Room) { + CPEnterRoomTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CPEnterRoomTableViewCell" forIndexPath:indexPath]; + cell.cpIndex = [[model.customInfo objectForKey:@"cpIndex"] integerValue]; + cell.dataSource = model.customInfo; + return cell; } else if (model.isBoom) { cellKey = @"XPRoomMessageTableViewCell_Boom"; @@ -1446,7 +1474,8 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey"; [_messageTableView registerClass:[XPRoomMessageTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomMessageTableViewCell class])]; [_messageTableView registerClass:[XPRoomMessageTableViewCell class] forCellReuseIdentifier:@"ChatMessage"]; [_messageTableView registerClass:[PIRoomMessagePhotoAlbumCell class] forCellReuseIdentifier:NSStringFromClass([PIRoomMessagePhotoAlbumCell class])]; - + [_messageTableView registerClass:[LuckyPackageMessageTableViewCell class] forCellReuseIdentifier:@"LuckyPackageMessageTableViewCell"]; + [_messageTableView registerClass:[CPEnterRoomTableViewCell class] forCellReuseIdentifier:@"CPEnterRoomTableViewCell"]; } return _messageTableView; } diff --git a/YuMi/Modules/YMRoom/View/RoomPhotoAlbum/Model/PIRoomPhotoAlbumItemModel.h b/YuMi/Modules/YMRoom/View/RoomPhotoAlbum/Model/PIRoomPhotoAlbumItemModel.h index 85087102..eb6e5753 100644 --- a/YuMi/Modules/YMRoom/View/RoomPhotoAlbum/Model/PIRoomPhotoAlbumItemModel.h +++ b/YuMi/Modules/YMRoom/View/RoomPhotoAlbum/Model/PIRoomPhotoAlbumItemModel.h @@ -23,6 +23,23 @@ NS_ASSUME_NONNULL_BEGIN @property(nonatomic,assign) int status; @property(nonatomic,copy) NSString *uid; @property(nonatomic,copy) NSString *totalGoldPrice; + +// 以下参数用于 vip 发图消息 +@property(nonatomic, copy) NSString *picUrl; +@property(nonatomic, copy) NSString *androidBubbleUrl; +@property(nonatomic, copy) NSString *avatar; +@property(nonatomic, copy) NSString *charmUrl; +@property(nonatomic, assign) NSInteger defUser; +@property(nonatomic, assign) NSInteger enterHide; +@property(nonatomic, assign) NSInteger erbanNo; +@property(nonatomic, assign) NSInteger experLevelSeq; +@property(nonatomic, copy) NSString *experUrl; +@property(nonatomic, copy) NSString *iosBubbleUrl; +@property(nonatomic, assign) NSInteger newUser; +@property(nonatomic, copy) NSString *nick; +@property(nonatomic, copy) NSString *vipIcon; +@property(nonatomic, copy) NSString *inRoomNameplatePic; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/RoomSideMenu/RoomSideMenu.m b/YuMi/Modules/YMRoom/View/RoomSideMenu/RoomSideMenu.m index 42b74214..fd344082 100644 --- a/YuMi/Modules/YMRoom/View/RoomSideMenu/RoomSideMenu.m +++ b/YuMi/Modules/YMRoom/View/RoomSideMenu/RoomSideMenu.m @@ -36,6 +36,10 @@ #import "XPArrangeMicViewController.h" #import "XPTreasureFairyViewController.h" +#import "RoomLuckyPackageInfoModel.h" +#import "LuckyPackageLogicManager.h" +#import "OpenLuckyPackageEntranceView.h" + UIKIT_EXTERN NSString *kShowFirstRechargeView; static CGFloat const kMenuItemSpacing = 4.0f; @@ -56,8 +60,10 @@ static CGFloat const kNormalHeight = 160.0f; @property (nonatomic,strong) UIImageView *joinView; @property(nonatomic,strong) PIRoomEnterRedPacketView *redPacketView; -@property(nonatomic, strong) UIView *scrollContain; +@property(nonatomic, strong) OpenLuckyPackageEntranceView *giftEntranceButton; + @property(nonatomic, strong) UIScrollView *scrollView; +@property(nonatomic, strong) UIStackView *scrollContainStack; @property (nonatomic,strong) SDCycleScrollView *cycleScrollView; @property (nonatomic, weak) id hostDelegate; @property (nonatomic, strong) NSMutableArray *activityList; @@ -73,11 +79,16 @@ static CGFloat const kNormalHeight = 160.0f; @property(nonatomic, assign) BOOL isExpand; +@property(nonatomic, strong) RoomLuckyPackageInfoModel *luckyPackageModel; + +@property(nonatomic, assign) BOOL isRequestingActivityList; + @end @implementation RoomSideMenu - (void)dealloc { + self.scrollView.delegate = nil; [[NSNotificationCenter defaultCenter] removeObserver:self]; [[RoomBoomManager sharedManager] removeEventListenerForTarget:self]; } @@ -96,11 +107,8 @@ static CGFloat const kNormalHeight = 160.0f; #pragma mark - Setup - (void)setupViews { - self.scrollContain = [[UIView alloc] init]; - self.scrollContain.backgroundColor = [UIColor purpleColor]; [self addSubview:self.cycleScrollView]; [self addSubview:self.scrollView]; - [self.scrollView addSubview:self.scrollContain]; [self addSubview:self.expandButton]; [self.cycleScrollView mas_makeConstraints:^(MASConstraintMaker *make) { @@ -113,6 +121,19 @@ static CGFloat const kNormalHeight = 160.0f; make.leading.trailing.bottom.equalTo(self); }]; + [self.scrollView addSubview:self.scrollContainStack]; + [self.scrollContainStack mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.equalTo(self.scrollView); + make.width.equalTo(self.scrollView); // 保证宽度与 scrollView 一致 +// make.leading.equalTo(self.scrollView); +// make.trailing.equalTo(self.scrollView); +// make.bottom.equalTo(self.scrollView); +// // 当内容较少时,stackView 的 top 不强制对齐 scrollView,而是至少不低于 scrollView 的顶部 +// make.top.greaterThanOrEqualTo(self.scrollView); +// // 确保宽度一致 +// make.width.equalTo(self.scrollView); + }]; + [self.expandButton mas_makeConstraints:^(MASConstraintMaker *make) { make.bottom.mas_equalTo(self.scrollView.mas_top); make.trailing.mas_equalTo(self.scrollView).offset(-4); @@ -163,8 +184,10 @@ static CGFloat const kNormalHeight = 160.0f; return NSOrderedSame; } }]; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ +} + +- (void)updateScrollViewEnd { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [self.menuItemViewsSubject sendNext:self.menuItemViews]; }); } @@ -174,7 +197,9 @@ static CGFloat const kNormalHeight = 160.0f; if (self.isLoadActivity) { [self configLittleGameActivity]; } else { - [self requestActivityList]; + if (!self.isRequestingActivityList) { + [self requestActivityList]; + } } } @@ -213,6 +238,33 @@ static CGFloat const kNormalHeight = 160.0f; } - (void)updateScrollView:(NSArray *)data { + // 清除 stackView 现有的所有子视图 + for (UIView *view in self.scrollContainStack.arrangedSubviews) { + [self.scrollContainStack removeArrangedSubview:view]; + [view removeFromSuperview]; + } + + // 如果数据为空,直接返回 + if (data.count == 0) { + return; + } + + // 添加新的菜单项视图到 stackView 中 + NSArray *reverseData = [data reverseObjectEnumerator].allObjects; + for (UIView *view in reverseData) { + [self.scrollContainStack addArrangedSubview:view]; + // 如果需要固定每个菜单项的高度,可以为每个 view 添加高度约束 + [view mas_makeConstraints:^(MASConstraintMaker *make) { + // 例如:固定高度为 scrollView 宽度减 30 + make.height.mas_equalTo(self.scrollView.bounds.size.width - 30); + }]; + } + + // 注意:使用 UIStackView 后,无需手动计算 contentSize, + // 系统会根据 stackView 的内容自动更新 scrollView 的滚动范围。 +} + +- (void)_updateScrollView:(NSArray *)data { [self.scrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; if (data.count == 0) { return; @@ -229,21 +281,6 @@ static CGFloat const kNormalHeight = 160.0f; // NSLog(@"--------------- blkaa 1 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]); CGFloat totalHeight = size.height * data.count + spacing * data.count; - if (totalHeight > self.scrollView.bounds.size.height) { - [self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.top.mas_equalTo(self.cycleScrollView.mas_bottom); - make.bottom.leading.trailing.mas_equalTo(self); - }]; - } else { - [self.scrollView mas_remakeConstraints:^(MASConstraintMaker *make) { - make.bottom.leading.trailing.mas_equalTo(self); - make.height.mas_equalTo(totalHeight); - }]; - } - -// [self layoutIfNeeded]; - -// NSLog(@"--------------- blkaa 2 blkaa: %@", [NSValue valueWithCGRect:self.scrollView.frame]); self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width, totalHeight); @@ -258,11 +295,15 @@ static CGFloat const kNormalHeight = 160.0f; lastItemView = view; // NSLog(@"--------------- blkaa %@ blkaa: %@", @(view.tag), [NSValue valueWithCGRect:view.frame]); } + + [self.scrollView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(lastItemView.mas_bottom); + make.left.right.equalTo(self); + make.bottom.equalTo(self); + }]; + dispatch_async(dispatch_get_main_queue(), ^{ - CGFloat bottomOffset = self.scrollView.contentSize.height - self.scrollView.bounds.size.height; - if (bottomOffset > 0) { - [self.scrollView setContentOffset:CGPointMake(0, bottomOffset) animated:YES]; - } + [self.scrollView setContentOffset:CGPointMake(0, self.scrollView.contentSize.height - self.scrollView.bounds.size.height) animated:YES]; }); [CATransaction commit]; @@ -273,6 +314,8 @@ static CGFloat const kNormalHeight = 160.0f; } - (void)requestActivityList { + self.isRequestingActivityList = YES; + RACSubject* playRAC = [RACSubject subject]; RACSubject* activityRAC = [RACSubject subject]; RACSubject* littleGameRAC = [RACSubject subject]; @@ -288,8 +331,11 @@ static CGFloat const kNormalHeight = 160.0f; self.playList = [NSMutableArray arrayWithArray:playModels]; self.activityList = [NSMutableArray arrayWithArray:activityModels]; self.littleGameList = [NSMutableArray arrayWithArray:littleGameModels]; - + [self onRoomUpdate]; + + self.isRequestingActivityList = NO; + return nil; }] subscribeError:^(NSError * _Nullable error) { [XNDJTDDLoadingTool showErrorWithMessage:error.domain]; @@ -298,6 +344,8 @@ static CGFloat const kNormalHeight = 160.0f; [self loadGames:playRAC]; [self loadActivities:activityRAC]; [self loadLittleGames:littleGameRAC]; + + [self requestLuckyPackage]; } - (void)loadGames:(RACSubject *)racSubject { @@ -343,6 +391,22 @@ static CGFloat const kNormalHeight = 160.0f; roomUid:roomUid]; } +- (void)requestLuckyPackage { + @kWeakify(self); + [[LuckyPackageLogicManager sharedInstance] requestRoomLuckyPackageAPI:self.hostDelegate.getRoomInfo.uid success:^(RoomLuckyPackageInfoModel * _Nonnull model) { + @kStrongify(self); + self.luckyPackageModel = model; + [self.giftEntranceButton updateEntrance:model]; + }]; + + [[LuckyPackageLogicManager sharedInstance] registerLuckyPackageUpdate:^(RoomLuckyPackageInfoModel * _Nullable model) { + @kStrongify(self); + self.luckyPackageModel = model; + [self.giftEntranceButton updateEntrance:model]; + [self loadLuckyPackage]; + }]; +} + -(void)dealWithData{ self.isLoadActivity = YES; self.cycleScrollView.hidden = NO; @@ -351,6 +415,8 @@ static CGFloat const kNormalHeight = 160.0f; [self updateMenuItem:self.gambleMenuButton isRemove:NO]; } + [self loadLuckyPackage]; + if (self.hostDelegate.getRoomInfo.type == RoomType_MiniGame) { [self configLittleGameActivity]; } else { @@ -526,9 +592,14 @@ static CGFloat const kNormalHeight = 160.0f; }]; } +- (void)didTapGiftEntrance { + +} + - (void)didTapExpand { self.isExpand = !self.isExpand; + [self.menuItemViews removeAllObjects]; [self.menuItemViewsSubject sendNext:self.menuItemViews]; @@ -548,6 +619,36 @@ static CGFloat const kNormalHeight = 160.0f; [self onRoomUpdate]; } +//- (void)didTapExpand:(UIButton *)sender { +// // 切换展开状态 +// self.isExpand = !self.isExpand; +// +// // 在动画前布局当前状态,避免初始跳动 +// [self layoutIfNeeded]; +// +// // 动画更新约束实现展开/折叠 +// [UIView animateWithDuration:0.3 +// delay:0 +// options:UIViewAnimationOptionCurveEaseInOut +// animations:^{ +// if (self.isExpand) { +// // 展开:调整相关约束(例如恢复内容高度) +// self.contentHeightConstraint.constant = /* 展开后的高度或自动布局值 */; +// // 如使用约束激活方式: +// // self.collapsedHeightConstraint.active = NO; +// } else { +// // 折叠:调整相关约束(例如将高度设为0) +// self.contentHeightConstraint.constant = 0; +// // 如使用约束激活方式: +// // self.collapsedHeightConstraint.active = YES; +// } +// // 在动画 block 内刷新布局,平滑过渡 +// [self.view layoutIfNeeded]; +// } completion:^(BOOL finished) { +// // 可选:动画完成后的处理 +// }]; +//} + #pragma mark - Room Delegate - (void)onRoomEntered { @@ -559,6 +660,8 @@ static CGFloat const kNormalHeight = 160.0f; [self.menuItemViews removeAllObjects]; [self.menuItemViewsSubject sendNext:self.menuItemViews]; + // TODO: 这里有短时内多次 add/remove view 的操作,需要优化 + switch (roomInfo.type) { case RoomType_MiniGame: [self displayForMiniGame]; @@ -600,6 +703,8 @@ static CGFloat const kNormalHeight = 160.0f; if(self.openRedPacketHandle){ self.openRedPacketHandle(nil,self.hostDelegate.getRoomInfo.type,YES); } + + [self updateScrollViewEnd]; } - (void)loadRedPacket:(RoomInfoModel *)roomInfo { @@ -610,6 +715,13 @@ static CGFloat const kNormalHeight = 160.0f; } } +- (void)loadLuckyPackage { + if (self.luckyPackageModel) { + [self updateMenuItem:self.giftEntranceButton isRemove:self.luckyPackageModel.redEnvelopeListVoList.count == 0]; + [self updateScrollViewEnd]; + } +} + - (void)loadPKView:(RoomInfoModel *)roomInfo { if (roomInfo.type == RoomType_Anchor || roomInfo.roomModeType == RoomModeType_Open_Blind) { [self updateMenuItem:self.pkMenuButton isRemove:YES]; @@ -655,11 +767,24 @@ static CGFloat const kNormalHeight = 160.0f; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { AttachmentModel *attachment = (AttachmentModel *)obj.attachment; - if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) { - FirstRechargeModel *model = [FirstRechargeModel modelWithJSON:attachment.data]; - XPFirstRechargeSuccessView * firstRechargeView= [[XPFirstRechargeSuccessView alloc] init]; - firstRechargeView.rechargeInfo = model; - [TTPopup popupView:firstRechargeView style:TTPopupStyleAlert]; + switch (attachment.first) { + case CustomMessageType_First_Recharge_Reward: { + if (attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) { + FirstRechargeModel *model = [FirstRechargeModel modelWithJSON:attachment.data]; + XPFirstRechargeSuccessView * firstRechargeView= [[XPFirstRechargeSuccessView alloc] init]; + firstRechargeView.rechargeInfo = model; + [TTPopup popupView:firstRechargeView style:TTPopupStyleAlert]; + } + } + break; + case CustomMessageType_RedPacket: { + if (attachment.second == Custom_Message_Sub_LuckyPackage) { + [[LuckyPackageLogicManager sharedInstance] receiveNewPostLuckyPackage:attachment]; + } + } + break; + default: + break; } } } @@ -805,6 +930,17 @@ static CGFloat const kNormalHeight = 160.0f; return _scrollView; } +- (UIStackView *)scrollContainStack { + if (!_scrollContainStack) { + _scrollContainStack = [[UIStackView alloc] init]; + _scrollContainStack.axis = UILayoutConstraintAxisVertical; + _scrollContainStack.alignment = UIStackViewAlignmentFill; + _scrollContainStack.distribution = UIStackViewDistributionEqualSpacing; + _scrollContainStack.spacing = kMenuItemSpacing; + } + return _scrollContainStack; +} + - (UIButton *)gambleMenuButton { if (!_gambleMenuButton) { UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom]; @@ -922,4 +1058,12 @@ static CGFloat const kNormalHeight = 160.0f; return _redPacketView; } +- (OpenLuckyPackageEntranceView *)giftEntranceButton { + if (!_giftEntranceButton) { + _giftEntranceButton = [[OpenLuckyPackageEntranceView alloc] init]; + _giftEntranceButton.tag = 107; + } + return _giftEntranceButton; +} + @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h index e937c76e..1cb6c014 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.h @@ -134,6 +134,11 @@ typedef NS_ENUM(NSUInteger, RoomSendGiftType) { @property(nonatomic, assign) NSInteger showAvatarType; // 是否需要塞头像,0-否,1-送礼者,2-收礼者,3-左送右收 @property(nonatomic, assign) NSInteger notifyFull; // 该礼物动画是否全房间播放 +@property(nonatomic, assign) NSInteger luckyPackageCount; // 用于记录发礼物红包时的数量 + +/// 排序 +@property (nonatomic, assign) NSInteger seqNo; + @end @interface GiftPanelTabModel : PIBaseModel diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.m b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.m index 7c0151b5..7abe40c9 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/Model/GiftInfoModel.m @@ -10,6 +10,29 @@ @implementation GiftInfoModel MJCodingImplementation + +- (BOOL)isEqual:(id)other +{ + if (other == self) { + return YES; + } + + if (![other isKindOfClass:[GiftInfoModel class]]) { + return NO; + } + + if ([(GiftInfoModel *)other giftId] == self.giftId) { + return YES; + } else { + return NO; + } +} + +- (NSUInteger)hash +{ + return [@(self.giftId) hash]; +} + @end @implementation GiftPanelTabModel @@ -38,5 +61,4 @@ MJCodingImplementation return GiftType_Game; } - @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m b/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m index 4f010323..5c3d29a3 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/Presenter/XPGiftStorage.m @@ -40,7 +40,11 @@ if (giftArray.count > 0 && roomUid.length > 0) { // 確保排序,後續使用二分法查找 NSArray *sortedGiftLists = [giftArray sortedArrayUsingComparator:^NSComparisonResult(GiftInfoModel *obj1, GiftInfoModel *obj2) { - return [@(obj1.giftId) compare:@(obj2.giftId)]; + NSComparisonResult result = [@(obj1.seqNo) compare:@(obj2.seqNo)]; + if (result == NSOrderedSame) { + return [@(obj2.giftId) compare:@(obj1.giftId)]; + } + return result; }]; [self.roomGiftCache setObject:sortedGiftLists forKey:roomUid]; } diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h index b3388a52..8a09d81f 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.h @@ -8,7 +8,7 @@ #import #import "XPGiftInfoView.h" NS_ASSUME_NONNULL_BEGIN -@class XPGiftBarView, XPGiftCountModel, WalletInfoModel; +@class XPGiftBarView, XPGiftCountModel, WalletInfoModel, UserInfoModel; @protocol XPGiftBarViewDelegate ///点击了充值的 - (void)xPGiftBarViewDidClickRecharge:(XPGiftBarView *)view;; @@ -36,6 +36,9 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic,assign) BOOL isShowFirstRecharge; ///是否可用 @property (nonatomic,assign) BOOL sendButtonIsEnable; + +@property(nonatomic, strong) UserInfoModel *userInfo; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m index 95b81400..e8156c32 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftBarView.m @@ -66,6 +66,13 @@ } return self; } + +- (void)setUserInfo:(UserInfoModel *)userInfo { + _userInfo = userInfo; + if (_giftCountView) { + + } +} #pragma mark - Response - (void)sendButtonAction:(UIButton *)sender { if (self.type == GiftSegmentType_Graffiti && self.drawGiftCount < 10) { @@ -518,7 +525,7 @@ - (XPGiftCountView *)giftCountView { if (!_giftCountView) { - _giftCountView = [[XPGiftCountView alloc] init]; + _giftCountView = [[XPGiftCountView alloc] initWithFrame:CGRectZero userInfo:self.userInfo]; _giftCountView.delegate = self; _giftCountView.hidden = YES; } diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.h b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.h index 4ea8e8c1..effa2327 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.h +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.h @@ -8,7 +8,7 @@ #import #import "XPGiftInfoView.h" NS_ASSUME_NONNULL_BEGIN -@class XPGiftCountView,XPGiftCountModel; +@class XPGiftCountView,XPGiftCountModel,UserInfoModel; @protocol XPGiftCountViewDelegate ///点击了多个个 @@ -17,10 +17,14 @@ NS_ASSUME_NONNULL_BEGIN @end @interface XPGiftCountView : UIView + +- (instancetype)initWithFrame:(CGRect)frame userInfo:(UserInfoModel *)userInfo; + ///代理 @property (nonatomic,weak) id delegate; /// @property (nonatomic,assign) GiftSegmentType segmentType; + -(void)reloadData; @end diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.m index b551ee87..288dcec1 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftCountView.m @@ -9,10 +9,13 @@ ///Third #import #import "NSArray+Safe.h" +#import "RoomResourceManager.h" ///Model #import "XPGiftCountModel.h" +#import "UserInfoModel.h" ///View #import "XPGiftCountCollectionViewCell.h" +#import "XPSkillCardPlayerManager.h" @interface XPGiftCountView () //列表 @property (nonatomic,strong) UICollectionView *countCollectionView; @@ -20,13 +23,19 @@ @property (nonatomic, strong) NSArray *giftCountArray; /// @property (nonatomic,strong) UIVisualEffectView *effectView; + +@property(nonatomic, strong) UserInfoModel *userInfo; @end @implementation XPGiftCountView - -- (instancetype)initWithFrame:(CGRect)frame { + +- (instancetype)initWithFrame:(CGRect)frame userInfo:(nonnull UserInfoModel *)userInfo { self = [super initWithFrame:frame]; if (self) { + if (userInfo == nil) { + userInfo = [[XPSkillCardPlayerManager shareInstance] userInfoModel]; + } + self.userInfo = userInfo; [self initSubViews]; [self initSubViewConstraints]; } @@ -90,22 +99,41 @@ ///一些公用的数据 - (NSArray *)commonGiftCountDataArray { - XPGiftCountModel *_1Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"1"]; + NSMutableArray *arr = @[].mutableCopy; + + if (self.userInfo) { + NSString *tempString = [[RoomResourceManager sharedManager] loadGiftPanelNum:self.userInfo.partitionId.integerValue]; + NSArray *tempArr = [tempString componentsSeparatedByString:@","]; + for (NSString *num in tempArr) { + XPGiftCountModel *model = [XPGiftCountModel initCountModel:@"" giftNumber:num]; + model.isOnlyNum = YES; + [arr addObject:model]; + } + } + + if (arr.count == 0) { + [arr addObjectsFromArray:[self defaultCommonGiftCountDataArray]]; + } + + return arr.copy; +} + +- (NSArray *)defaultCommonGiftCountDataArray { + XPGiftCountModel *_1Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"1"]; _1Dic.isOnlyNum = YES; - XPGiftCountModel *_10Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"10"]; + XPGiftCountModel *_10Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"10"]; _10Dic.isOnlyNum = YES; - XPGiftCountModel *_66Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"66"]; + XPGiftCountModel *_66Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"66"]; _66Dic.isOnlyNum = YES; - XPGiftCountModel *_99Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"99"]; + XPGiftCountModel *_99Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"99"]; _99Dic.isOnlyNum = YES; - XPGiftCountModel *_188Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"188"]; + XPGiftCountModel *_188Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"188"]; _188Dic.isOnlyNum = YES; - XPGiftCountModel *_520Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"520"]; + XPGiftCountModel *_520Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"520"]; _520Dic.isOnlyNum = YES; - XPGiftCountModel *_1314Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"1314"]; + XPGiftCountModel *_1314Dic = [XPGiftCountModel initCountModel:@"" giftNumber:@"1314"]; _1314Dic.isOnlyNum = YES; - NSArray * array = @[_1Dic, _10Dic, _66Dic, _99Dic,_188Dic,_520Dic, _1314Dic]; - return array; + return @[_1Dic, _10Dic, _66Dic, _99Dic,_188Dic,_520Dic, _1314Dic]; } #pragma mark - UICollectionViewDelegate && UICollectionViewDataSource @@ -147,13 +175,12 @@ [self.countCollectionView reloadData]; - - } -(void)reloadData{ [self.countCollectionView reloadData]; } + #pragma mark - Getters And Setters - (UICollectionView *)countCollectionView{ if (!_countCollectionView) { diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.m index de38262b..03848075 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPGiftInfoView.m @@ -178,13 +178,7 @@ } - (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - if (self.datasource.count == 0) { - XPGiftEmptyCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftEmptyCollectionViewCell class]) forIndexPath:indexPath]; - cell.emptyTitle = YMLocalizedString(@"XPGiftInfoView1"); - return cell; - } - - if ((self.segmentType == GiftSegmentType_Pack || self.segmentType == GiftSegmentType_WeekStar) && self.datasource.count == 0) { + if (self.datasource.count == 0 || ((self.segmentType == GiftSegmentType_Pack || self.segmentType == GiftSegmentType_WeekStar) && self.datasource.count == 0)) { XPGiftEmptyCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftEmptyCollectionViewCell class]) forIndexPath:indexPath]; cell.emptyTitle = YMLocalizedString(@"XPGiftInfoView1"); return cell; @@ -200,21 +194,23 @@ GiftInfoModel * giftInfo = [self.datasource xpSafeObjectAtIndex:indexPath.item]; giftInfo.isSelected = self.lastSelectGift.giftId == giftInfo.giftId; - if(self.freeModel != nil && self.segmentType == GiftSegmentType_Pack && giftInfo.giftId == self.freeModel.giftId.integerValue){ + if(self.freeModel != nil && + self.segmentType == GiftSegmentType_Pack && + giftInfo.giftId == self.freeModel.giftId.integerValue){ XPGiftFreeItemCell *itemCell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftFreeItemCell class]) forIndexPath:indexPath]; itemCell.giftInfo = giftInfo; itemCell.freeModel = self.freeModel; return itemCell; + } else { + XPGiftItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath]; + cell.usingplaceType = self.usingPlaceType; + cell.curUserNobleLevel = self.curUserNobleLevel; + cell.giftInfo = giftInfo; + return cell; } - XPGiftItemCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([XPGiftItemCollectionViewCell class]) forIndexPath:indexPath]; - - cell.usingplaceType = self.usingPlaceType; - cell.curUserNobleLevel = self.curUserNobleLevel; - cell.giftInfo = giftInfo; - return cell; } - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { diff --git a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m index 78f0be23..a2b92db8 100644 --- a/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m +++ b/YuMi/Modules/YMRoom/View/SendGiftView/View/XPSendGiftView.m @@ -748,6 +748,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; ///点击了切换不同礼物的tabbar - (void)pIGiftInfoSegmentedView:(PIGiftInfoSegmentedView *)view didClickSegment:(GiftSegmentType)type{ self.segmentType = type; + self.giftBarView.userInfo = [self.delegate getUserInfo]; self.giftBarView.type = type; self.giftBarView.drawGiftCount = 10; [self.superGiftView removeFromSuperview]; @@ -1055,6 +1056,7 @@ UIKIT_EXTERN NSString * kShowFirstRechargeView; #pragma mark - Getters And Setters - (void)setUsingplaceType:(SendGiftType)usingplaceType { _usingplaceType = usingplaceType; + self.giftBarView.userInfo = [self.delegate getUserInfo]; self.giftBarView.usingplaceType = usingplaceType; self.giftInfoView.usingPlaceType = _usingplaceType; self.headTypeView.hidden = _usingplaceType == SendGiftType_User; diff --git a/YuMi/Modules/YMRoom/View/Setting/Presenter/XPRoomSettingPresenter.m b/YuMi/Modules/YMRoom/View/Setting/Presenter/XPRoomSettingPresenter.m index 8425bb2e..be5ee0ec 100644 --- a/YuMi/Modules/YMRoom/View/Setting/Presenter/XPRoomSettingPresenter.m +++ b/YuMi/Modules/YMRoom/View/Setting/Presenter/XPRoomSettingPresenter.m @@ -326,9 +326,12 @@ @kStrongify(self); NSArray *list = [XPMessageRemoteExtModel modelsWithArray:data.data]; [[self getView]getRoomOnlineUserListSuccess:list]; - } fail:^(NSInteger code, NSString * _Nullable msg) { - - }] roomUid:roomUid]; + } fail:^(NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); + if ([[self getView] instancesRespondToSelector:@selector(getRoomOnlineUserFailure:)]) { + [[self getView] getRoomOnlineUserFailure:msg]; + } + }] roomUid:roomUid]; } /// 关闭房间礼物值 /// @param roomUid 房间的uid diff --git a/YuMi/Modules/YMRoom/View/Setting/Protocol/XPRoomSettingProtocol.h b/YuMi/Modules/YMRoom/View/Setting/Protocol/XPRoomSettingProtocol.h index 6e864bc3..9a0b602c 100644 --- a/YuMi/Modules/YMRoom/View/Setting/Protocol/XPRoomSettingProtocol.h +++ b/YuMi/Modules/YMRoom/View/Setting/Protocol/XPRoomSettingProtocol.h @@ -32,6 +32,7 @@ NS_ASSUME_NONNULL_BEGIN - (void)updateRoomInfoFail:(NSString *)message; //获取房间在线用户成功 -(void)getRoomOnlineUserListSuccess:(NSArray *)list; +-(void)getRoomOnlineUserFailure:(NSString *)msg; -(void)closeRoomGiftValueSuccessWithItemModel:(XPRoomSettingItemModel *)itemModel; -(void)closeRoomGiftValueFailWithItemModel:(XPRoomSettingItemModel *)itemModel; -(void)openRoomGiftValueSuccessWithItemModel:(XPRoomSettingItemModel *)itemModel; diff --git a/YuMi/Modules/YMRoom/View/Setting/View/XPRoomOnLineViewController.m b/YuMi/Modules/YMRoom/View/Setting/View/XPRoomOnLineViewController.m index c52c9e02..cbc6a559 100644 --- a/YuMi/Modules/YMRoom/View/Setting/View/XPRoomOnLineViewController.m +++ b/YuMi/Modules/YMRoom/View/Setting/View/XPRoomOnLineViewController.m @@ -120,13 +120,13 @@ } - (void)refreshData { + [XNDJTDDLoadingTool showLoading]; [self.presenter getRoomOnlineUserListWithRoomUid:self.roomId]; } - - //获取房间在线用户成功 -(void)getRoomOnlineUserListSuccess:(NSArray *)list{ + [XNDJTDDLoadingTool hideHUD]; NSMutableArray *temp = @[].mutableCopy; for (XPMessageRemoteExtModel *model in list) { if (model.platformRole == 0) { @@ -136,9 +136,13 @@ self.datasource = temp; [self.tableView reloadData]; + self.tableView.hidden = NO; } - +-(void)getRoomOnlineUserFailure:(NSString *)msg { + [XNDJTDDLoadingTool showErrorWithMessage:msg]; + self.tableView.hidden = NO; +} #pragma mark - NIMChatManagerDelegate - (void)onRecvMessages:(NSArray *)messages { @@ -278,6 +282,7 @@ } [_tableView registerClass:[XPRoomOnlineTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomOnlineTableViewCell class])]; [_tableView registerClass:[XPRoomRoleEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomRoleEmptyTableViewCell class])]; + _tableView.hidden = YES; } return _tableView; } diff --git a/YuMi/Modules/YMRoom/View/StageView/StageView.h b/YuMi/Modules/YMRoom/View/StageView/StageView.h index 29981a4d..75190936 100644 --- a/YuMi/Modules/YMRoom/View/StageView/StageView.h +++ b/YuMi/Modules/YMRoom/View/StageView/StageView.h @@ -73,7 +73,7 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, weak, readonly) id hostDelegate; - (instancetype)initWithDelegate:(id)delegate; --(void)exitRoom; +-(void)exitNIMRoom; @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMRoom/View/StageView/StageView.m b/YuMi/Modules/YMRoom/View/StageView/StageView.m index 0f6a4b62..20fbb0ee 100644 --- a/YuMi/Modules/YMRoom/View/StageView/StageView.m +++ b/YuMi/Modules/YMRoom/View/StageView/StageView.m @@ -646,7 +646,7 @@ } } ///自己退出房间,如果在麦上要自己下麦 --(void)exitRoom{ +-(void)exitNIMRoom{ RoomInfoModel * roomInfo =self.hostDelegate.getRoomInfo; NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.uid]; for (MicroQueueModel *sequence in self.micQueue.allValues) { @@ -809,6 +809,42 @@ } #pragma mark - StageViewDelegate - 留给子 View 重写的模板方法 +- (void)displayUserCard:(NSString *)targetUid position:(NSString *)position model:(MicroQueueModel*)micModel { + UserInfoModel* userInfo = self.hostDelegate.getUserInfo; + RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo; + + XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init]; + model.uid = targetUid; + model.position = position; + model.posState = micModel.microState.posState; + model.micState = micModel.microState.micState; + model.nick = userInfo.nick; + model.roomInfo = roomInfo; + model.micQueue = self.micQueue; + model.delegate = self.hostDelegate; + model.superMangerList = self.hostDelegate.getRoomSuperAdminList; + model.platformRole = micModel.userInfo.platformRole; + UserRoomCardViewController *vc = [[UserRoomCardViewController alloc] initWithUser:model controlUser:self.hostDelegate.getUserInfo]; + vc.modalPresentationStyle = UIModalPresentationOverFullScreen; + [self.hostDelegate.getCurrentNav presentViewController:vc animated:NO completion:nil]; +} + +- (void)nimUpMic:(NSString *)key roomId:(NSString *)roomId isFromDownMic:(BOOL)isFromDownMic { + UserInfoModel* userInfo = self.hostDelegate.getUserInfo; + NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init]; + request.key = key; + request.value = [[self userInfoToQueueExt:userInfo] toJSONString]; + request.roomId = roomId; + request.transient = YES; + @kWeakify(self); + [[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) { + @kStrongify(self); + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + self.isUpingMic = NO; + }); + }]; +} + - (void)didSelectAtIndex:(NSInteger)index { MicroQueueModel* micModel = [self.micQueue objectForKey:[self indexToPosition:index]]; @@ -828,20 +864,9 @@ } if (targetUid && targetUid.length > 0) { - XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init]; - model.uid = targetUid; - model.position = position; - model.posState = micModel.microState.posState; - model.micState = micModel.microState.micState; - model.nick = userInfo.nick; - model.roomInfo = roomInfo; - model.micQueue = self.micQueue; - model.delegate = self.hostDelegate; - model.superMangerList = self.hostDelegate.getRoomSuperAdminList; - model.platformRole = micModel.userInfo.platformRole; - UserRoomCardViewController *vc = [[UserRoomCardViewController alloc] initWithUser:model controlUser:self.hostDelegate.getUserInfo]; - vc.modalPresentationStyle = UIModalPresentationOverFullScreen; - [self.hostDelegate.getCurrentNav presentViewController:vc animated:NO completion:nil]; + [self displayUserCard:targetUid + position:position + model:micModel]; return; } @@ -850,20 +875,41 @@ return; } + if (self.isUpingMic) { + [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"StageView21")]; + return; + } + + self.isUpingMic = YES; + // 2. 空麦位,上麦逻辑 NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init]; request.roomId = roomId; request.userIds = @[uid]; + + @kWeakify(self); [[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray * _Nullable members) { + @kStrongify(self); + + if (error) { + self.isUpingMic = NO; + return; + } + NIMChatroomMember * member = members.firstObject; - if (!member) return; + if (!member) { + self.isUpingMic = NO; + return; + } void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){ if (!self.hadGetQueueInfoSuccess) { + self.isUpingMic = NO; return; } MicroQueueModel* micModel = [self.micQueue objectForKey:up]; if (micModel.userInfo) {///麦上已经有人,不上麦 + self.isUpingMic = NO; [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"StageView4")]; return; } @@ -871,37 +917,14 @@ if (roomInfo.type == RoomType_19Mic && micModel.microState.position == 6 ) { [Api requestBossMicUp:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { if (code == 200) { - NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init]; - request.key = up; - request.value = [[self userInfoToQueueExt:userInfo] toJSONString]; - request.roomId = roomId; - request.transient = YES; - [[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) { - if (isFromDownMic) { - self.isUpingMic = NO; - } - if (error) { - - } - }]; + [self nimUpMic:up roomId:roomId isFromDownMic:isFromDownMic]; } else { + self.isUpingMic = NO; [XNDJTDDLoadingTool showErrorWithMessage:msg]; } } roomUid:@(roomInfo.uid).stringValue uid:uid]; } else { - NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init]; - request.key = up; - request.value = [[self userInfoToQueueExt:userInfo] toJSONString]; - request.roomId = roomId; - request.transient = YES; - [[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) { - if (isFromDownMic) { - self.isUpingMic = NO; - } - if (error) { - - } - }]; + [self nimUpMic:up roomId:roomId isFromDownMic:isFromDownMic]; } }; @@ -932,7 +955,15 @@ isAppAdmin:YES]; // 2.0.2 闭麦/开麦 TTActionSheetConfig *muteMic = [self muteMicAction:position room:roomInfo mic:micModel isAppAdmin:YES]; - [TTPopup actionSheetWithItems:@[lockMic, muteMic]]; + @kWeakify(self); + [TTPopup actionSheetWithItems:@[lockMic, muteMic] cancelHandler:^{ + @kStrongify(self); + self.isUpingMic = NO; + }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + @kStrongify(self); + self.isUpingMic = NO; + }); return; } @@ -955,7 +986,17 @@ // 抱Ta上麦 TTActionSheetConfig *inviteMic = [self inviteMicAction:position room:roomInfo mic:micModel]; - [TTPopup actionSheetWithItems:@[upMic, inviteMic, lockMic, muteMic]]; + @kWeakify(self); + TTPopupConfig *config = [[TTPopupConfig alloc] init]; + + [TTPopup actionSheetWithItems:@[upMic, inviteMic, lockMic, muteMic] cancelHandler:^{ + @kStrongify(self); + self.isUpingMic = NO; + }]; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + @kStrongify(self); + self.isUpingMic = NO; + }); } else { // 2.2 非管理员点击了空麦位 if (micModel.microState.posState == MicroPosStateType_Lock) { @@ -966,18 +1007,14 @@ [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"StageView20")]; } } + self.isUpingMic = NO; return; }; NSString* selfUid = [NSString stringWithFormat:@"%ld", (long)self.hostDelegate.getUserInfo.uid]; UIView* microView = [self findMicroViewByUid:selfUid]; if (microView) { - if (self.isUpingMic) { - [XNDJTDDLoadingTool showErrorWithMessage:YMLocalizedString(@"StageView21")]; - } else { - self.isUpingMic = YES; - nimDownQueue([self indexToPosition:microView.tag], position); - } + nimDownQueue([self indexToPosition:microView.tag], position); } else { nimUpQueue(position, NO); } @@ -998,6 +1035,7 @@ if (roomInfo.type == RoomType_19Mic && micInfo.microState.position == 6 ) { @kWeakify(self); [Api requestBossMicUp:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); if (code == 200) { if (microView) { if (blockDown) { @@ -1038,12 +1076,14 @@ }else { lockTitle = micInfo.microState.posState == MicroPosStateType_Free ? YMLocalizedString(@"StageView23") : YMLocalizedString(@"StageView10"); } + @kWeakify(self); TTActionSheetConfig *lockMic = [TTActionSheetConfig normalTitle:lockTitle clickAction:^{ NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid]; NSString * state = micInfo.microState.posState == MicroPosStateType_Free ? @"1" : @"0"; NSString * ticket = [[AccountInfoStorage instance] getTicket]; NSString * uid = [[AccountInfoStorage instance] getUid]; [Api microLockCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); if (code == 200 && isAppAdmin && state.integerValue == 1) { NIMMessage * message = [[NIMMessage alloc] init]; AttachmentModel * attachMent = [[AttachmentModel alloc] init]; @@ -1058,8 +1098,10 @@ NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) { - + self.isUpingMic = NO; }]; + } else { + self.isUpingMic = NO; } } roomUid:roomUid state:state position:position ticket:ticket uid:uid]; }]; @@ -1071,6 +1113,8 @@ room:(RoomInfoModel *)roomInfo mic:(MicroQueueModel *)micInfo isAppAdmin:(BOOL)isAppAdmin { + + @kWeakify(self); NSString * muteTitle = micInfo.microState.micState == MicroMicStateType_Open ? YMLocalizedString(@"StageView25") : YMLocalizedString(@"StageView14"); TTActionSheetConfig *muteMic = [TTActionSheetConfig normalTitle:muteTitle clickAction:^{ NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid]; @@ -1078,6 +1122,7 @@ NSString * ticket = [[AccountInfoStorage instance] getTicket]; NSString * uid = [[AccountInfoStorage instance] getUid]; [Api microMuteCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + @kStrongify(self); if (code == 200 && isAppAdmin && state.integerValue == 1) { NIMMessage * message = [[NIMMessage alloc] init]; AttachmentModel * attachMent = [[AttachmentModel alloc] init]; @@ -1092,8 +1137,10 @@ NSString * sessionId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; NIMSession *session = [NIMSession session:sessionId type:NIMSessionTypeChatroom]; [[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session completion:^(NSError * _Nullable error) { - + self.isUpingMic = NO; }]; + } else { + self.isUpingMic = NO; } } roomUid:roomUid state:state position:position ticket:ticket uid:uid]; }]; @@ -1105,7 +1152,9 @@ mic:(MicroQueueModel *)micInfo { NSString * inviteTitle = ([position isEqualToString:@"-1"] && roomInfo.roomModeType == RoomModeType_Open_Blind) ? YMLocalizedString(@"StageView27") : YMLocalizedString(@"StageView18"); NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId]; + @kWeakify(self); TTActionSheetConfig *inviteMic = [TTActionSheetConfig normalTitle:inviteTitle clickAction:^{ + @kStrongify(self); XPRoomInviteUserViewController * inviteUserMicVC = [[XPRoomInviteUserViewController alloc] init]; inviteUserMicVC.isManagerOrOwner = ([position isEqualToString:@"-1"] && roomInfo.roomModeType == RoomModeType_Open_Blind); inviteUserMicVC.roomId = roomId; @@ -1114,6 +1163,7 @@ inviteUserMicVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid]; inviteUserMicVC.blindDateVipUid = roomInfo.blindDateVipUid; [self.hostDelegate.getCurrentNav pushViewController:inviteUserMicVC animated:YES]; + self.isUpingMic = NO; }]; return inviteMic; } diff --git a/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m b/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m index c51dd271..7424cfb8 100644 --- a/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m +++ b/YuMi/Modules/YMRoom/View/UserCard/Presenter/XPUserCardPresenter.m @@ -63,11 +63,13 @@ /// @param uid 自己的uid /// @param targetUid 对方的uid - (void)userAttentionStatus:(NSString *)uid targetUid:(NSString *)targetUid { + @kWeakify(self); [Api attentionStatusCompletion:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + @kStrongify(self); BOOL isLike = ((NSNumber *)data.data).boolValue; self.attentionItem.isSelect = isLike; [[self getView] onGetFollowDataSccess]; - }errorToast:NO] uid:uid isLikeUid:targetUid]; + } errorToast:NO ] uid:uid isLikeUid:targetUid]; } diff --git a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m index 82b46ede..bd4b90d4 100644 --- a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m +++ b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m @@ -1067,6 +1067,10 @@ return [[XPUserCardPresenter alloc] init]; } +- (void)dealloc { + [XNDJTDDLoadingTool hideHUD]; +} + - (instancetype)initWithUser:(XPUserCardInfoModel *)cardInfo controlUser:(nonnull UserInfoModel *)meInfo { if (self = [super init]) { self.modalPresentationStyle = UIModalPresentationOverFullScreen; @@ -1080,6 +1084,7 @@ [super viewDidLoad]; self.datasource = @[]; self.micActions = @[]; + [self setupUI]; [self loadUserInfo]; [self loadFunctionsItem]; @@ -1089,13 +1094,16 @@ - (void)setupUI { self.view.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.0]; + self.view.alpha = 0; + [XNDJTDDLoadingTool showLoading]; + 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]; [self.view addSubview:self.avatar]; [self.avatar mas_makeConstraints:^(MASConstraintMaker *make) { @@ -1647,6 +1655,19 @@ [((UINavigationController *)self.presentingViewController) pushViewController:userInfoVC animated:YES]; } +- (void)reloadAllUI { + [self.collectionView reloadData]; +// [XNDJTDDLoadingTool showLoading]; +// // 使用 dispatch_async 延迟执行逻辑 +// dispatch_async(dispatch_get_main_queue(), ^{ +// // reloadData 执行完成后的逻辑 +// NSLog(@"CollectionView Reloaded Successfully"); +// // 执行你指定的后续操作 +// self.view.hidden = NO; +// }); + +} + #pragma mark - - (void)onGetUserInfoSuccess:(UserInfoModel *)userInfo { self.userInfoModel = userInfo; @@ -1674,7 +1695,7 @@ [self.view insertSubview:self.topMP4View aboveSubview:self.vipBGImageView]; [self.topMP4View mas_makeConstraints:^(MASConstraintMaker *make) { make.leading.trailing.mas_equalTo(self.view).inset(-34); - make.centerY.mas_equalTo(self.avatar).offset(50); + make.centerY.mas_equalTo(self.avatar).offset(70); make.height.mas_equalTo(300); }]; } @@ -1756,7 +1777,6 @@ self.micActions = temp_2.copy; [self.presenter getMicroFunctionItemsByUserInfo:self.cardInfo me:self.controlUserInfo]; } - [self.collectionView reloadData]; } - (void)onGetMicroFunctionArraySuccess:(NSArray *)array { @@ -1765,7 +1785,7 @@ [temp addObject:[self transModelFrom:model]]; } self.micActions = temp; - [self.collectionView reloadData]; + [self reloadAllUI]; if (self.micActions.count == 0) { self.collectionHeight = 120 + 30 + 60 + ([self configRoomDatingPickHeart] ? 68 : 0) + kSafeAreaBottomHeight; @@ -1775,11 +1795,14 @@ CGFloat space_top = KScreenHeight - self.collectionHeight; [UIView animateWithDuration:0.25 animations:^{ self.collectionView.frame = CGRectMake(0, space_top, KScreenWidth, self.collectionHeight); + } completion:^(BOOL finished) { + self.view.alpha = 1; + [XNDJTDDLoadingTool hideHUD]; }]; } -(void)onGetFollowDataSccess{ - [self.collectionView reloadData]; + [self reloadAllUI]; } - (XPUserCardItemModel *)transModelFrom:(XPUserCardMicroItemModel *)model { @@ -1799,7 +1822,7 @@ *stop = YES; } }]; - [self.collectionView reloadData]; + [self reloadAllUI]; } - (void)markUserManagerFinish:(XPUserCardItemModel *)item error:(NSError *)error { @@ -1816,7 +1839,7 @@ *stop = YES; } }]; - [self.collectionView reloadData]; + [self reloadAllUI]; } } @@ -2229,6 +2252,8 @@ [UserRoomCardNameplateCell registerTo:_collectionView]; [UserRoomCardUserActionCell registerTo:_collectionView]; [UserRoomCardMicActionCell registerTo:_collectionView]; + +// _collectionView.hidden = YES; } return _collectionView; } diff --git a/YuMi/Modules/YMRoom/View/XPRoomViewController.m b/YuMi/Modules/YMRoom/View/XPRoomViewController.m index fd4d8edc..ce5fca2a 100644 --- a/YuMi/Modules/YMRoom/View/XPRoomViewController.m +++ b/YuMi/Modules/YMRoom/View/XPRoomViewController.m @@ -93,7 +93,7 @@ #import "XPSendGiftView.h" #import "RoomSideMenu.h" #import "RoomResourceManager.h" - +#import "LuckyPackageLogicManager.h" //#import "XPMineHallAnchorIncomeStatisViewController.h" @@ -1006,7 +1006,7 @@ XPCandyTreeInsufficientBalanceViewDelegate> return; } _roomInfo = roomInfo; - + [[LuckyPackageLogicManager sharedInstance] setRoomUid:@(roomInfo.uid).stringValue]; [[RoomResourceManager sharedManager] updateCurrentSkinID:roomInfo.usedMicSkinId effectID:roomInfo.usedMicEffectId]; @@ -1844,20 +1844,6 @@ XPCandyTreeInsufficientBalanceViewDelegate> if (message.session.sessionType != NIMSessionTypeChatroom) { continue; } - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[self.userInfo.partitionId]]; - if([message.session.sessionId isEqualToString:publicChatRoomId]){ - // 非本房间不处理 - if (message.messageType == NIMMessageTypeNotification) { - [self.messageContainerView handleNIMNotificationMessage:message]; - }else if(message.messageType == NIMMessageTypeText) { - [self.messageContainerView handleNIMTextMessage:message]; - }else if(message.messageType == NIMMessageTypeImage){ - [self.messageContainerView handleNIMImageMessage:message]; - }else if(message.messageType == NIMMessageTypeCustom){ - [self.messageContainerView handleNIMCustomMessage:message]; - } - continue; - } if (![message.session.sessionId isEqualToString:@(self.roomInfo.roomId).stringValue]) { continue; @@ -2049,6 +2035,7 @@ XPCandyTreeInsufficientBalanceViewDelegate> [self.sideMenu handleNIMCustomMessage:message]; [self.functionView handleNIMCustomMessage:message]; [self.littleGameView handleNIMCustomMessage:message]; + [self.messageContainerView handleNIMCustomMessage:message]; if (attachment.first == CustomMessageType_First_Recharge_Reward && attachment.second == Custom_Message_Sub_Room_First_Recharge_Reward) { self.userInfo.isFirstCharge = NO; @@ -2176,7 +2163,6 @@ XPCandyTreeInsufficientBalanceViewDelegate> } } } - [self.messageContainerView handleNIMCustomMessage:message]; } } else if(message.messageType == NIMMessageTypeText) { [self.messageContainerView handleNIMTextMessage:message]; @@ -2269,17 +2255,6 @@ XPCandyTreeInsufficientBalanceViewDelegate> } } - NSString *publicChatRoomId = [NSString stringWithFormat:@"%@",[ClientConfig shareConfig].configInfo.publicChatRoomIdMap[self.userInfo.partitionId]]; - if([message.session.sessionId isEqualToString:publicChatRoomId]){ - // 非本房间不处理 - if(message.messageType == NIMMessageTypeText) { - [self.messageContainerView handleNIMTextMessage:message]; - }else if(message.messageType == NIMMessageTypeImage){ - [self.messageContainerView handleNIMImageMessage:message]; - } - return; - } - if (![message.session.sessionId isEqualToString:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]) { return; } @@ -2364,123 +2339,129 @@ XPCandyTreeInsufficientBalanceViewDelegate> } - (void)exitRoom { + [XNDJTDDLoadingTool showLoading]; + [XPSkillCardPlayerManager shareInstance].micState = MICState_None; - [self.stageView exitRoom]; + [self.stageView exitNIMRoom]; [self.menuContainerView menuResignFirstResponder]; [self.animationView resumeTimer]; - if (self.roomInfo.roomModeType == RoomModeType_Open_Micro_Mode || self.roomInfo.roomModeType == RoomModeType_Open_Blind) { - NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid]; - NSString * uid = [AccountInfoStorage instance].getUid; - [Api getRoomArrangeMicList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - if (code == 200) { - ArrangeMicModel * arrangeMicModel= [ArrangeMicModel modelWithJSON:data.data]; - if (arrangeMicModel.myPos.intValue > 0) { - [TTPopup alertWithMessage:YMLocalizedString(@"XPRoomViewController11") confirmHandler:^{ - __block NSString * grouptype = @"0"; - if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) { - [arrangeMicModel.queue enumerateObjectsUsingBlock:^(ArrangeMicUserModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - if (obj.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) { - grouptype = [NSString stringWithFormat:@"%ld", obj.groupType]; - *stop = YES; - } - }]; - } - [Api cancelArrangeMic:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - - } roomUid:roomUid operUid:uid groupType:grouptype]; - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [[RtcManager instance] exitRoom]; - [self.presenter reportUserOutRoom:roomUid]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; - } cancelHandler:^{ - - }]; - return; - } - } - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [[RtcManager instance] exitRoom]; - [self.presenter reportUserOutRoom:roomUid]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; - } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; - } else if(self.roomInfo.roomModeType == RoomModeType_Open_PK_Mode) { - NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid]; - NSString * uid = [AccountInfoStorage instance].getUid; - [Api getRoomPKUserList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - if (code == 200) { - ArrangeMicModel * arrangeMicModel= [ArrangeMicModel modelWithJSON:data.data]; - if (arrangeMicModel.myPos.intValue > 0) { - [TTPopup alertWithMessage:YMLocalizedString(@"XPRoomViewController11") confirmHandler:^{ - __block NSString * grouptype = @"0"; + switch (self.roomInfo.roomModeType) { + case RoomModeType_Open_Micro_Mode: + case RoomModeType_Open_Blind: + [self exitRoomAndCancelArrangeMic]; + break; + case RoomModeType_Open_PK_Mode: + [self exitRoomWhenPKing]; + break; + case RoomType_MiniGame: + [self exitRoomWhenPlayMiniGame]; + break; + default: + [self exitRoomPage]; + break; + } +} + +- (void)exitRoomAndCancelArrangeMic { + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid]; + NSString * uid = [AccountInfoStorage instance].getUid; + [Api getRoomArrangeMicList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + ArrangeMicModel * arrangeMicModel= [ArrangeMicModel modelWithJSON:data.data]; + if (arrangeMicModel.myPos.intValue > 0) { + [TTPopup alertWithMessage:YMLocalizedString(@"XPRoomViewController11") confirmHandler:^{ + __block NSString * grouptype = @"0"; + if (self.roomInfo.roomModeType == RoomModeType_Open_Blind) { [arrangeMicModel.queue enumerateObjectsUsingBlock:^(ArrangeMicUserModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { if (obj.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) { grouptype = [NSString stringWithFormat:@"%ld", obj.groupType]; *stop = YES; } }]; - [Api cancelRoomPKArrangeMic:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - - } roomUid:roomUid operUid:uid groupType:grouptype]; - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [[RtcManager instance] exitRoom]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; - } cancelHandler:^{ + } + [Api cancelArrangeMic:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { - }]; - return; - } + } roomUid:roomUid operUid:uid groupType:grouptype]; + + [self exitRoomPage]; + } cancelHandler:^{ + + }]; + return; } - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [[RtcManager instance] exitRoom]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; - } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; - }else if(self.roomInfo.type == RoomType_MiniGame) { - if ([self.littleGameView isInSudGame]) { - TTAlertConfig *config = [[TTAlertConfig alloc] init]; - config.cancelButtonConfig.title = YMLocalizedString(@"XPRoomSettingInputView4"); - config.confirmButtonConfig.title = YMLocalizedString(@"TTAlertConfig0"); - config.message = YMLocalizedString(@"XPRoomViewController14"); - @kWeakify(self); - [TTPopup alertWithConfig:config confirmHandler:^{ // 知道了 - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - @kStrongify(self); - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[RtcManager instance] exitRoom]; - [self.littleGameView handleSelfInExitEvent]; - [self.littleGameView destroyMG]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; - }); - } cancelHandler:^{ - }]; - } else { - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[RtcManager instance] exitRoom]; - [self.littleGameView handleSelfInExitEvent]; - [self.littleGameView destroyMG]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; } + + [self exitRoomPage]; + } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; +} + +- (void)exitRoomWhenPKing { + NSString * roomUid = [NSString stringWithFormat:@"%ld", self.roomInfo.uid]; + NSString * uid = [AccountInfoStorage instance].getUid; + [Api getRoomPKUserList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + ArrangeMicModel * arrangeMicModel= [ArrangeMicModel modelWithJSON:data.data]; + if (arrangeMicModel.myPos.intValue > 0) { + [TTPopup alertWithMessage:YMLocalizedString(@"XPRoomViewController11") confirmHandler:^{ + __block NSString * grouptype = @"0"; + [arrangeMicModel.queue enumerateObjectsUsingBlock:^(ArrangeMicUserModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + if (obj.uid.integerValue == [AccountInfoStorage instance].getUid.integerValue) { + grouptype = [NSString stringWithFormat:@"%ld", obj.groupType]; + *stop = YES; + } + }]; + [Api cancelRoomPKArrangeMic:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + + } roomUid:roomUid operUid:uid groupType:grouptype]; + + [self exitRoomPage]; + } cancelHandler:^{ + + }]; + return; + } + } + + [self exitRoomPage]; + + } roomUid:roomUid operUid:uid page:@"1" pageSize:@"50"]; +} + +- (void)exitRoomWhenPlayMiniGame { + if ([self.littleGameView isInSudGame]) { + TTAlertConfig *config = [[TTAlertConfig alloc] init]; + config.cancelButtonConfig.title = YMLocalizedString(@"XPRoomSettingInputView4"); + config.confirmButtonConfig.title = YMLocalizedString(@"TTAlertConfig0"); + config.message = YMLocalizedString(@"XPRoomViewController14"); + @kWeakify(self); + [TTPopup alertWithConfig:config confirmHandler:^{ // 知道了 + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + @kStrongify(self); + [self exitRoomPage]; + }); + } cancelHandler:^{ + }]; + } else { + [self exitRoomPage]; } - else { - [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; - [[XPRoomMiniManager shareManager] resetLocalMessage]; - [[RtcManager instance] exitRoom]; - [self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]]; - [self handleFirstOutRoom]; - [self dismissViewControllerAnimated:YES completion:nil]; +} + +- (void)exitRoomPage { + if (self.roomInfo.roomModeType == RoomType_MiniGame) { + [self.littleGameView handleSelfInExitEvent]; + [self.littleGameView destroyMG]; } + [[XPRoomMiniManager shareManager] resetLocalMessage]; + [[RtcManager instance] exitRoom]; + [self.presenter exitNIMRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.roomId]]; + [self.presenter reportUserOutRoom:[NSString stringWithFormat:@"%ld", self.roomInfo.uid]]; + [self handleFirstOutRoom]; + [self dismissViewControllerAnimated:YES completion:^{ + [XNDJTDDLoadingTool hideHUD]; + }]; } - (void)miniRoom { diff --git a/YuMi/Modules/YMWeb/XPWebViewController.m b/YuMi/Modules/YMWeb/XPWebViewController.m index e1e4a765..9ba461d4 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.m +++ b/YuMi/Modules/YMWeb/XPWebViewController.m @@ -307,6 +307,25 @@ NSString * const kJSOpenPaymentCallback = @"openPaymentCallback"; #endif } +#if DEBUG +- (void)webView:(WKWebView *)webView decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse + decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler { + + NSHTTPURLResponse *response = (NSHTTPURLResponse *)navigationResponse.response; + NSDictionary *headers = response.allHeaderFields; + NSLog(@"Response Headers: %@", headers); + + NSString *contentEncoding = headers[@"Content-Encoding"]; + if ([contentEncoding isEqualToString:@"gzip"]) { + NSLog(@"✅ Gzip 响应已启用"); + } else { + NSLog(@"❌ Gzip 响应未启用"); + } + + decisionHandler(WKNavigationResponsePolicyAllow); +} +#endif + //加载失败 - (void)webView:(WKWebView *)webView didFailProvisionalNavigation:(WKNavigation *)navigation withError:(NSError *)error { //加载失败同样需要隐藏progressView diff --git a/YuMi/Network/HttpRequestHelper.m b/YuMi/Network/HttpRequestHelper.m index c5774d66..3057f570 100644 --- a/YuMi/Network/HttpRequestHelper.m +++ b/YuMi/Network/HttpRequestHelper.m @@ -93,13 +93,13 @@ params = [self configBaseParmars:editParam]; #ifdef DEBUG - NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + NSLog(@"\nmethod:\n%@\nparameter:\n%@\n", method, params); #endif @kWeakify(self); [manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; #ifdef DEBUG - NSLog(@"%@ - \n%@", method, [baseModel toJSONString]); + NSLog(@"%@ - \n%@\n", method, [baseModel toJSONString]); #else #endif success(baseModel); @@ -126,7 +126,7 @@ params = [self configBaseParmars:params]; #ifdef DEBUG - NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + NSLog(@"\nmethod:\n%@\nparameter:\n%@\n", method, params); #else #endif @@ -146,7 +146,7 @@ constructingBodyWithBlock:^(id _Nonnull formData) { success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; #ifdef DEBUG - NSLog(@"\n%@", [baseModel toJSONString]); + NSLog(@"\n%@\n", [baseModel toJSONString]); #else #endif success(baseModel); @@ -171,14 +171,14 @@ constructingBodyWithBlock:^(id _Nonnull formData) { params = [self configBaseParmars:params]; AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; #ifdef DEBUG - NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + NSLog(@"\nmethod:\n%@\nparameter:\n%@\n", method, params); #else #endif @kWeakify(self); [manager DELETE:method parameters:params headers:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; #ifdef DEBUG - NSLog(@"\n%@", [baseModel toJSONString]); + NSLog(@"\n%@\n", [baseModel toJSONString]); #else #endif success(baseModel); diff --git a/YuMi/Resources/cp/CP进场.svga b/YuMi/Resources/cp/CP进场.svga new file mode 100644 index 00000000..c79f0736 Binary files /dev/null and b/YuMi/Resources/cp/CP进场.svga differ diff --git a/YuMi/Resources/game/coincoin.mp4 b/YuMi/Resources/game/coincoin.mp4 new file mode 100644 index 00000000..e76e3342 Binary files /dev/null and b/YuMi/Resources/game/coincoin.mp4 differ diff --git a/YuMi/Resources/game/giftgift.mp4 b/YuMi/Resources/game/giftgift.mp4 new file mode 100644 index 00000000..553daa4e Binary files /dev/null and b/YuMi/Resources/game/giftgift.mp4 differ diff --git a/YuMi/Structure/MVP/Model/UserInfoModel.h b/YuMi/Structure/MVP/Model/UserInfoModel.h index be2c2b1e..8185c161 100644 --- a/YuMi/Structure/MVP/Model/UserInfoModel.h +++ b/YuMi/Structure/MVP/Model/UserInfoModel.h @@ -175,7 +175,7 @@ NS_ASSUME_NONNULL_BEGIN /// @property (nonatomic,strong) NSMutableAttributedString *levelAtt; @property (nonatomic,strong) NSMutableAttributedString *idAtt; -///是否是代充 +///是否是代充代理 @property(nonatomic,assign) BOOL isRechargeUser; ///pk时不能禁麦 @property(nonatomic,assign) BOOL isNoProhibitMic; @@ -202,6 +202,8 @@ NS_ASSUME_NONNULL_BEGIN - (BOOL)isHeadWearSVGA; +- (BOOL)isArabia; + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Structure/MVP/Model/UserInfoModel.m b/YuMi/Structure/MVP/Model/UserInfoModel.m index 3c900487..7ed9d33a 100644 --- a/YuMi/Structure/MVP/Model/UserInfoModel.m +++ b/YuMi/Structure/MVP/Model/UserInfoModel.m @@ -72,4 +72,8 @@ return self.headwearType == 1 || self.headWearType == 1; } +- (BOOL)isArabia { + return [self.partitionId isEqualToString:@"2"]; +} + @end diff --git a/YuMi/Structure/MVP/Model/UserVipInfoVo.h b/YuMi/Structure/MVP/Model/UserVipInfoVo.h index a6121840..58df0eea 100644 --- a/YuMi/Structure/MVP/Model/UserVipInfoVo.h +++ b/YuMi/Structure/MVP/Model/UserVipInfoVo.h @@ -42,6 +42,8 @@ NS_ASSUME_NONNULL_BEGIN @property (nonatomic, copy) NSString *nameplateUrl; +@property(nonatomic, assign) BOOL roomPicScreen; // 是否能发送房间公屏图片消息 + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/Tools/Date/NSDate+DateUtils.h b/YuMi/Tools/Date/NSDate+DateUtils.h index b5b20088..32ed6f7c 100644 --- a/YuMi/Tools/Date/NSDate+DateUtils.h +++ b/YuMi/Tools/Date/NSDate+DateUtils.h @@ -27,6 +27,9 @@ NS_ASSUME_NONNULL_BEGIN #pragma mark - 将某个时间戳转化成 时间 + (NSString *)timestampSwitchTime:(NSInteger)timestamp formatter:(NSString *)format; + (NSInteger)pleaseInsertStarTimeo:(NSString *)time1 andInsertEndTime:(NSString *)time2; + +- (NSString *) stringForYearMonthDayDashed; + @end @interface NSCalendar (Pick) diff --git a/YuMi/Tools/UILabel/UILabel+Utils.h b/YuMi/Tools/UILabel/UILabel+Utils.h index 9c2001fa..6ac1e0af 100644 --- a/YuMi/Tools/UILabel/UILabel+Utils.h +++ b/YuMi/Tools/UILabel/UILabel+Utils.h @@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN +(UILabel *)labelInitWithText:(NSString *)text font:(UIFont *)font textColor:(UIColor *)textColor; + (CGFloat)getLabelHeightWithText:(NSString *)text width:(CGFloat)width font:(UIFont *)font; + (CGFloat)getWidthWithText:(NSString *)text height:(CGFloat)height font:(UIFont *)font; + + @end NS_ASSUME_NONNULL_END diff --git a/YuMi/ar.lproj/Localizable.strings b/YuMi/ar.lproj/Localizable.strings index d29d8624..f184aee0 100644 --- a/YuMi/ar.lproj/Localizable.strings +++ b/YuMi/ar.lproj/Localizable.strings @@ -3812,12 +3812,6 @@ ineHeadView12" = "الحمل"; //MSRoomGameWebVC "MSRoomGameWebVC0"="هل أنت متأكد أنك تريد الخروج من اللعبة؟"; -"MSSessionPublicChatHallVC0"="دردشة عامة"; -"MSSessionPublicChatHallVC1"="~اريد تصدر العناوين"; -"MSSessionPublicChatHallVC2"="دردشة عامة"; -"MSSessionReleaseHeadlinesView0"="(الرجاء إدخال المحتوي الذي تريد أن تتصدر عناوينهّ~ )يقتصر على 100 كلمة"; -"MSSessionReleaseHeadlinesView1"=" تصدر العناوين%@"; -"MSSessionContextHeadlinesView0"="~عزيزي%@، هيا تصدر العناوين "; ///MSRoomSetingBackdropCell "MSRoomSetingBackdropCell0"="قيد الاستخدام"; "MSRoomSetingBackdropCell1"="هل أنت متأكد أنك تريد اختيار هذه الصورة لتكون خلفية لغرفتك؟"; @@ -4079,3 +4073,59 @@ ineHeadView12" = "الحمل"; "1.0.34_text_14" = "لقد تمت إزالتك كمسؤول بواسطة %@ معرف الغرفة: %@."; "1.0.34_text_15" = "لقد تم تعيينك كمدير من قبل المضيف"; "1.0.34_text_16" = "لقد تمت إزالتك كمدير من قبل المضيف"; + +"1.0.37_text_1" = "هدية حقيبة الحظ"; +"1.0.37_text_2" = "كونزة حقيبة الحظ"; +"1.0.37_text_3" = "اختر هدية"; +"1.0.37_text_4" = "عدد حقيبة الحظ"; +"1.0.37_text_5" = "وقت الانتظار"; +"1.0.37_text_6" = "أرسلت حقيبة الحظ"; +"1.0.37_text_7" = "%@دقائق"; +"1.0.37_text_8" = "عدد حقيبة الحظ"; +"1.0.37_text_9" = "إجمالي الإنفاق %@ عملة"; +"1.0.37_text_11" = "أرسل %@ هدية، أنفق %@ عملة"; +"1.0.37_text_12" = "تعديل "; +"1.0.37_text_13" = "وقت الانتظار %@ دقيقة"; +"1.0.37_text_14" = "استلمت حقيبة الحظ"; +"1.0.37_text_15" = "أرسلت حقيبة الحظ"; +"1.0.37_text_15.1" = "أرسل حقيبة الحظ هدية"; +"1.0.37_text_15.2" = "أرسل حقيبة الحظ عملة"; +"1.0.37_text_17.1" = "%@حقيبة الحظ هدية "; +"1.0.37_text_17.2" = "%@حقيبة الحظ عملة "; +"1.0.37_text_18" = "قريبًا"; +"1.0.37_text_19" = "عرض الآخرين >"; +"1.0.37_text_20" = "انقر و فتح"; +"1.0.37_text_21" = "تم استلام جميع حقائب الحظ."; +"1.0.37_text_22" = "Me"; +"1.0.37_text_23" = "حقيبة الحظ التي تم فتحها خلال 24 ساعة + سيتم رد أموالها"; +"1.0.37_text_24" = "نرسل حقيبة حظ الهدية! تعال وانضم إلينا!"; +"1.0.37_text_25" = "نرسل حقيبة حظ الكونزة! تعال وانضم إلينا!"; +"1.0.37_text_26" = "تسجيل الدخول بالايدي"; +"1.0.37_text_27" = "تسجيل الدخول بالرسائل القصيرة"; +"1.0.37_text_28" = "رصيد العملة الحالي غير كافٍ يرجى إعادة الشحن"; +"1.0.37_text_29" = "الرجاء اختيار الهدية أولا +"; +"1.0.37_text_30" = "الرجاء إدخال الرقم"; +"1.0.37_text_31" = "لقد دخل @% @% من @% إلى الغرفة"; +"1.0.37_text_32" = "%@ %@&%@ كلاهما على الميكروفون!"; +"1.0.37_text_33" = "هذه الوظيفة متاحة للمستخدمين فوق مستوى VIP5. يرجى ترقية مستوى VIP الخاص بك أولاً!"; +"1.0.37_text_34" = "تحويل الكونزات"; +"1.0.37_text_35" = "عرض التفاصيل "; +"1.0.37_text_36" = "وكيل إعادة الشحن الفرعي"; +"1.0.37_text_37" = "التحويلات الأخيرة"; +"1.0.37_text_38" = "تحويل الراتب"; +"1.0.37_text_39" = "قائمة وكلاء إعادة الشحن الفرعيين"; +"1.0.37_text_40" = "التحويل خلال الثلاثين يومًا الماضية"; +"1.0.37_text_41" = "سجل التحويلات"; +"1.0.37_text_42" = "هذه الدورة"; +"1.0.37_text_43" = "الدورة الأخيرة"; +"1.0.37_text_44" = "إجمالي مبلغ تحويلات الكونزات"; +"1.0.37_text_45" = "إجمالي مبلغ تحويل الراتب"; +"1.0.37_text_46" = "التحويل"; +"1.0.37_text_47" = "السجل"; +"1.0.37_text_48" = "تحويل الراتب:%@ÜS"; +"1.0.37_text_49" = "%@ÜS"; +"1.0.37_text_50" = "تم وضع الكونزات في المحفظة!"; +"1.0.37_text_51" = "تم وضع الهدايا في الحقيبة!"; +"1.0.37_text_52" = "لا يمكنك استخدام هذه الميزة."; diff --git a/YuMi/en.lproj/Localizable.strings b/YuMi/en.lproj/Localizable.strings index edb8a269..bd9f35d8 100644 --- a/YuMi/en.lproj/Localizable.strings +++ b/YuMi/en.lproj/Localizable.strings @@ -1,6 +1,4 @@ - - "XPWishGiftEmptyTableViewCell0" = "No data"; "XPWishGiftTableViewCell0" = "Edit"; @@ -3606,14 +3604,6 @@ //MSRoomGameWebVC "MSRoomGameWebVC0"="Are you sure you want to exit the game?"; ///MSSessionPublicChatHallVC -"MSSessionPublicChatHallVC0"="Chatting"; -"MSSessionPublicChatHallVC1"="I want headlines~"; -"MSSessionPublicChatHallVC2"="Chatting"; -///MSSessionReleaseHeadlinesView -"MSSessionReleaseHeadlinesView0"="Enter your headline content~ (100 characters max)"; -"MSSessionReleaseHeadlinesView1"=" %@ makes headlines"; -///MSSessionContextHeadlinesView -"MSSessionContextHeadlinesView0"="Honorable %@, you've made the headlines~"; ///MSRoomSetingBackdropCell "MSRoomSetingBackdropCell0"="In use"; @@ -3867,3 +3857,57 @@ "1.0.34_text_14" = "You have been removed as an admin by %@ room ID: %@."; "1.0.34_text_15" = "You have been set as a manager by the host"; "1.0.34_text_16" = "You have been removed as a manager by the host"; + +"1.0.37_text_1" = "Gift Lucky Bag"; +"1.0.37_text_2" = "Coin Lucky Bag"; +"1.0.37_text_3" = "Choose Gift"; +"1.0.37_text_4" = "Lucky Bag Numbers"; +"1.0.37_text_5" = "Waiting time"; +"1.0.37_text_6" = "Send Gift Lucky Bag"; +"1.0.37_text_7" = "%@Mins"; +"1.0.37_text_8" = "Lucky Bag Numbers"; +"1.0.37_text_9" = "Total spend %@ coins"; +"1.0.37_text_11" = "Send %@ gifts, spend %@ coins"; +"1.0.37_text_12" = "Modify "; +"1.0.37_text_13" = "Waiting time %@ minutes"; +"1.0.37_text_14" = "Received Lucky Bag"; +"1.0.37_text_15" = "Sent Lucky Bag"; +"1.0.37_text_15.1" = "Send Gift Lucky Bag"; +"1.0.37_text_15.2" = "Send Coin Lucky Bag"; +"1.0.37_text_17.1" = "%@'s Gift Lucky Bag!"; +"1.0.37_text_17.2" = "%@'s Coin Lucky Bag!"; +"1.0.37_text_18" = "Coming soon"; +"1.0.37_text_19" = "View Others >"; +"1.0.37_text_20" = "Click Open"; +"1.0.37_text_21" = "All the Lucky Bag ready been claimed."; +"1.0.37_text_22" = "Me"; +"1.0.37_text_23" = "Lucky Bag opened within 24hrs will be refunded"; +"1.0.37_text_24" = "Are sending Gift Lucky Bag! "; +"1.0.37_text_25" = "Are sending Coin Lucky Bag! "; +"1.0.37_text_26" = "ID Login"; +"1.0.37_text_27" = "SMS Login"; +"1.0.37_text_28" = "Current coin balance is insufficient, please recharge!"; +"1.0.37_text_29" = "Please select a gift first"; +"1.0.37_text_30" = "Please enter number"; +"1.0.37_text_31" = "%@'s %@ %@ has entered the room."; +"1.0.37_text_32" = "%@ %@&%@ are both on the mic!"; +"1.0.37_text_33" = "This function is open to users above VIP5. Please upgrade your VIP Level first!"; +"1.0.37_text_34" = "Transfer Coins"; +"1.0.37_text_35" = "View details "; +"1.0.37_text_36" = "Sub Recharge Agent"; +"1.0.37_text_37" = "Recent Transfers"; +"1.0.37_text_38" = "ÜS Settlement"; +"1.0.37_text_39" = "Sub Recharge Agent List"; +"1.0.37_text_40" = "Transfer Past 30 days"; +"1.0.37_text_41" = "Transfer History"; +"1.0.37_text_42" = "This Cycle"; +"1.0.37_text_43" = "Last Cycle"; +"1.0.37_text_44" = "Total Amount of Transfer Coins"; +"1.0.37_text_45" = "Total Amount of ÜS Settlement"; +"1.0.37_text_46" = "Transfer"; +"1.0.37_text_47" = "History"; +"1.0.37_text_48" = "Settlement:%@ÜS"; +"1.0.37_text_49" = "%@ÜS"; +"1.0.37_text_50" = "Coins have been put into the wallet!"; +"1.0.37_text_51" = "Gifts have been put into the bag!"; +"1.0.37_text_52" = "Your cannot use this feature."; diff --git a/YuMi/tr.lproj/Localizable.strings b/YuMi/tr.lproj/Localizable.strings index 269e9f8b..e54a72c8 100644 --- a/YuMi/tr.lproj/Localizable.strings +++ b/YuMi/tr.lproj/Localizable.strings @@ -3067,13 +3067,6 @@ //MSRoomGameWebVC "MSRoomGameWebVC0"="Oyundan çıkmak istediğinize emin misiniz?"; ///MSSessionPublicChatHallVC -"MSSessionPublicChatHallVC0"="Genel Sohbet Odası"; -"MSSessionPublicChatHallVC1"="Manşet olmak istiyorum~"; -"MSSessionPublicChatHallVC2"="Genel Sohbet"; -///MSSessionReleaseHeadlinesView -"MSSessionReleaseHeadlinesView0"="Manşet olmak istediğiniz içeriği girin~ (Sadece 100 karakter)"; -"MSSessionReleaseHeadlinesView1"=" %@ Manşete çıktı"; - ///MSSessionContextHeadlinesView "MSSessionContextHeadlinesView0"="%@, Manşete çıktı~"; ///MSRoomSetingBackdropCell @@ -3658,3 +3651,57 @@ "1.0.34_text_14" = "%@ oda kimliği: %@ tarafından yönetici olarak kaldırıldınız."; "1.0.34_text_15" = "Oda sahibi sizi yönetici olarak ayarladı"; "1.0.34_text_16" = "Oda sahibi sizi yöneticilikten çıkardı"; + +"1.0.37_text_1" = "Hediye Şanslı Çanta"; +"1.0.37_text_2" = "Madeni Para Şanslı Çanta"; +"1.0.37_text_3" = "Hediye Seç"; +"1.0.37_text_4" = "Şanslı Çanta Sayıları"; +"1.0.37_text_5" = "Bekleme süresi"; +"1.0.37_text_6" = "Gönderilen Şanslı Çanta"; +"1.0.37_text_7" = "%@Dakika"; +"1.0.37_text_8" = "Şanslı Çanta Sayıları"; +"1.0.37_text_9" = "Toplam harcama %@ jeton"; +"1.0.37_text_11" = "%@ hediye gönder, %@ jeton harca"; +"1.0.37_text_12" = "Değiştir "; +"1.0.37_text_13" = "Bekleme süresi %@ dakika"; +"1.0.37_text_14" = "Alınan Şanslı Çanta"; +"1.0.37_text_15" = "Gönderilen Şanslı Çanta"; +"1.0.37_text_15.1" = "أرسل حقيبة الحظ هدية"; +"1.0.37_text_15.2" = "Madeni Para Şanslı Çanta Gönder"; +"1.0.37_text_17.1" = "%@'ın Hediye Şanslı Çantası!"; +"1.0.37_text_17.2" = "%@'ın Madeni Para Şanslı Çantası!"; +"1.0.37_text_18" = "Yakında geliyor"; +"1.0.37_text_19" = "Diğerlerini görüntüle >"; +"1.0.37_text_20" = "Aç'a tıkla"; +"1.0.37_text_21" = "Tüm Şanslı Çantalar talep edildi."; +"1.0.37_text_22" = "Me"; +"1.0.37_text_23" = "24 saat içinde açılan Şanslı Çantalar iade edilecektir"; +"1.0.37_text_24" = "Hediye Şanslı Çanta gönderiyor!"; +"1.0.37_text_25" = "Coin Lucky Bag gönderiyoruz!"; +"1.0.37_text_26" = "Kimlik Girişi"; +"1.0.37_text_27" = "SMS Girişi"; +"1.0.37_text_28" = "Mevcut bakiyeniz yetersiz, lütfen bakiyenizi yenileyin!"; +"1.0.37_text_29" = "Lütfen önce bir hediye seçin"; +"1.0.37_text_30" = "Lütfen numarayı giriniz"; +"1.0.37_text_31" = "%@'ın %@ %@'si odaya girdi."; +"1.0.37_text_32" = "%@ %@&%@ ikisi de mikrofonda!"; +"1.0.37_text_33" = "Bu fonksiyon VIP5 üstü kullanıcılara açıktır. Lütfen önce VIP Seviyenizi yükseltin!"; +"1.0.37_text_34" = "Transfer Coins"; +"1.0.37_text_35" = "Ayrıntıları görüntüle "; +"1.0.37_text_36" = "Alt Yükleme Temsilcisi"; +"1.0.37_text_37" = "Son Transferler"; +"1.0.37_text_38" = "ÜS Hesaplaşması"; +"1.0.37_text_39" = "Alt Yükleme Temsilcisi Listesi"; +"1.0.37_text_40" = "Geçmiş 30 gün içindeki transfer"; +"1.0.37_text_41" = "Transfer Geçmişi"; +"1.0.37_text_42" = "Bu Döngü"; +"1.0.37_text_43" = "Son Döngü"; +"1.0.37_text_44" = "Toplam Coin Transferi Miktarı"; +"1.0.37_text_45" = "ÜS Hesaplaşmasının Toplam Miktarı"; +"1.0.37_text_46" = "Transfer"; +"1.0.37_text_47" = "Geçmiş"; +"1.0.37_text_48" = "ÜS Hesaplaşması:%@ÜS"; +"1.0.37_text_49" = "%@ÜS"; +"1.0.37_text_50" = "Cüzdana paralar konuldu!"; +"1.0.37_text_51" = "Çantaya hediyeler konuldu!"; +"1.0.37_text_52" = "Bu özelliği kullanamazsınız."; diff --git a/YuMi/zh-Hant.lproj/Localizable.strings b/YuMi/zh-Hant.lproj/Localizable.strings index 7c736153..869b2b20 100644 --- a/YuMi/zh-Hant.lproj/Localizable.strings +++ b/YuMi/zh-Hant.lproj/Localizable.strings @@ -3262,14 +3262,7 @@ //MSRoomGameWebVC "MSRoomGameWebVC0"="確定退出遊戲嗎?"; ///MSSessionPublicChatHallVC -"MSSessionPublicChatHallVC0"="公聊廳"; -"MSSessionPublicChatHallVC1"="我要上頭條~"; -"MSSessionPublicChatHallVC2"="公聊"; -///MSSessionReleaseHeadlinesView -"MSSessionReleaseHeadlinesView0"="請輸入想上頭條的內容~(僅限100字)"; -"MSSessionReleaseHeadlinesView1"=" %@上頭條"; -///MSSessionContextHeadlinesView -"MSSessionContextHeadlinesView0"="尊貴的%@,上頭條啦~"; + ///MSRoomSetingBackdropCell "MSRoomSetingBackdropCell0"="使用中"; "MSRoomSetingBackdropCell1"="確認選擇這張圖片作為房間主題嗎?"; @@ -3526,5 +3519,59 @@ "1.0.34_text_15" = "您已被房主設置為管理員"; "1.0.34_text_16" = "您已被房主移除管理員"; +"1.0.37_text_1" = "禮物幸運福袋"; +"1.0.37_text_2" = "金币幸運福袋"; +"1.0.37_text_3" = "選擇禮物"; +"1.0.37_text_4" = "幸運福袋數量"; +"1.0.37_text_5" = "等待時間"; +"1.0.37_text_6" = "發出幸運福袋"; +"1.0.37_text_7" = "%@分鐘"; +"1.0.37_text_8" = "幸運福袋數量"; +"1.0.37_text_9" = "總計花費 %@ 枚幣"; +"1.0.37_text_10" = "Gift"; +"1.0.37_text_11" = "送出 %@ 份禮物,共花費 %@ 枚幣"; +"1.0.37_text_12" = "修改 "; +"1.0.37_text_13" = "等待時間 %@ 分鐘"; +"1.0.37_text_14" = "收到幸運福袋"; +"1.0.37_text_15" = "發出幸運福袋"; +"1.0.37_text_15.1" = "送出禮物幸運福袋"; +"1.0.37_text_15.2" = "送出金币幸運福袋"; +//"1.0.37_text_16" = "Are sending Gift Lucky Bag! Come and join!"; +"1.0.37_text_17.1" = "%@ 的禮物幸運福袋!"; +"1.0.37_text_17.2" = "%@ 的金币幸運福袋!"; +"1.0.37_text_18" = "即將開抢"; +"1.0.37_text_19" = "查看他人 >"; +"1.0.37_text_20" = "點擊打開"; +"1.0.37_text_21" = "所有的幸運福袋已經被領取完畢。"; +"1.0.37_text_22" = "Me"; +"1.0.37_text_23" = "未於24小時內開啟的幸運福袋將會退還"; +"1.0.37_text_24" = "正在發送禮物幸運福袋!"; +"1.0.37_text_25" = "正在發送金币幸運福袋!"; +"1.0.37_text_26" = "ID 登入"; +"1.0.37_text_27" = "SMS 登入"; +"1.0.37_text_28" = "當前金幣餘額不足,請儲值!"; +"1.0.37_text_29" = "請先選擇禮物"; +"1.0.37_text_30" = "請輸入數字"; +"1.0.37_text_31" = "%@的%@ %@已進入房間。"; +"1.0.37_text_32" = "%@ %@ 和 %@ 都在麥克風上!"; +"1.0.37_text_33" = "此功能對VIP5以上用戶開放,請先升级VIP等级吧!"; - +"1.0.37_text_34" = "轉贈金幣"; +"1.0.37_text_35" = "詳情 "; +"1.0.37_text_36" = "子代理"; +"1.0.37_text_37" = "最近轉贈"; +"1.0.37_text_38" = "代發薪資"; +"1.0.37_text_39" = "子代理列表"; +"1.0.37_text_40" = "近30天轉贈"; +"1.0.37_text_41" = "轉贈歷史"; +"1.0.37_text_42" = "本週期"; +"1.0.37_text_43" = "上週期"; +"1.0.37_text_44" = "金幣轉贈"; +"1.0.37_text_45" = "代發薪"; +"1.0.37_text_46" = "轉贈"; +"1.0.37_text_47" = "歷史"; +"1.0.37_text_48" = "薪資:%@ÜS"; +"1.0.37_text_49" = "%@ÜS"; +"1.0.37_text_50" = "硬幣已放入錢包!"; +"1.0.37_text_51" = "禮物已放入背包!"; +"1.0.37_text_52" = "您無法使用此功能。";