diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index 4970f402..5e7acfd0 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -525,6 +525,7 @@ 54B9C6F72C9D8D05003F1CC5 /* 4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */; }; 54B9C6F82C9D8D05003F1CC5 /* 5.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */; }; 54B9C6F92C9D8D05003F1CC5 /* 3.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */; }; + 54B9C6FB2C9DA4C4003F1CC5 /* CP绑定.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6FA2C9DA4C4003F1CC5 /* CP绑定.mp4 */; }; 54C3895C2C215F5100FD47B1 /* XPHomeMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */; }; 54C3895F2C2189DD00FD47B1 /* XPHomeMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895E2C2189DD00FD47B1 /* XPHomeMinePresenter.m */; }; 54C389622C23BD1600FD47B1 /* HomeRankAvatarModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C389612C23BD1600FD47B1 /* HomeRankAvatarModel.m */; }; @@ -2595,6 +2596,7 @@ 54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 3.mp4; sourceTree = ""; }; 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 4.mp4; sourceTree = ""; }; 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.mp4; sourceTree = ""; }; + 54B9C6FA2C9DA4C4003F1CC5 /* CP绑定.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CP绑定.mp4"; sourceTree = ""; }; 54C3895A2C215F5100FD47B1 /* XPHomeMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMineViewController.h; sourceTree = ""; }; 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeMineViewController.m; sourceTree = ""; }; 54C3895D2C2189DD00FD47B1 /* XPHomeMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMinePresenter.h; sourceTree = ""; }; @@ -6485,6 +6487,7 @@ 54FFD3802C9BD12600DE61E5 /* cp */ = { isa = PBXGroup; children = ( + 54B9C6FA2C9DA4C4003F1CC5 /* CP绑定.mp4 */, 54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */, 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */, 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */, @@ -11159,6 +11162,7 @@ E80EC84628ACD84000D133C5 /* emoji_98@2x.png in Resources */, E80EC84728ACD84000D133C5 /* emoji_104@2x.png in Resources */, E80EC83328ACD84000D133C5 /* emoji_136@2x.png in Resources */, + 54B9C6FB2C9DA4C4003F1CC5 /* CP绑定.mp4 in Resources */, E80EC82628ACD84000D133C5 /* emoji_10@2x.png in Resources */, E80EC82C28ACD84000D133C5 /* emoji_59@2x.png in Resources */, E80EC81A28ACD84000D133C5 /* emoji_161@2x.png in Resources */, diff --git a/YuMi/Modules/YMMessage/Model/AttachmentModel.h b/YuMi/Modules/YMMessage/Model/AttachmentModel.h index 7ebba5d1..03895c6a 100644 --- a/YuMi/Modules/YMMessage/Model/AttachmentModel.h +++ b/YuMi/Modules/YMMessage/Model/AttachmentModel.h @@ -64,6 +64,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) { CustomMessageType_LuckyBag = 61, ///发现萌新 CustomMessageType_FindNew = 62, + /// CP 礼物 + CustomMessageType_CP = 64, ///塔罗 CustomMessageType_Tarot = 71, ///相亲 @@ -709,6 +711,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeMoneyFlow) { Custom_Message_Sub_Money_Flow = 1110, }; +typedef NS_ENUM(NSUInteger, CustomMessageTypeCPGift) { + Custom_Message_Sub_CP_Gift = 641, // 礼物聊屏 + Custom_Message_Sub_CP_Upgrade = 642, // 升级 + Custom_Message_Sub_CP_Binding = 643, // 绑定 +}; + @interface AttachmentModel : PIBaseModel @property (nonatomic,assign) int first; @property (nonatomic,assign) int second; diff --git a/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoViewController.m b/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoViewController.m index e0b4c318..9eac2f94 100644 --- a/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoViewController.m +++ b/YuMi/Modules/YMMine/View/MineInfo/XPMineUserInfoViewController.m @@ -389,7 +389,7 @@ HWDMP4PlayDelegate> if (self.userInfo.relationUserVO.showCpAnim && self.userInfo.relationUserVO.cpLevel >= 3) { [self.view addSubview:self.vapView]; NSString *filePath = [[NSBundle mainBundle] pathForResource:@(self.userInfo.relationUserVO.cpLevel).stringValue ofType:@"mp4"]; - [self.vapView playHWDMP4:filePath delegate:self];//在view上播放该特效,按该view的大小进行渲染 + [self.vapView playHWDMP4:filePath delegate:self]; } } diff --git a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m index 2d07e980..7837b6bb 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/XPRoomAnimationView.m @@ -71,7 +71,19 @@ #import "LuckyGiftWinningBannerView.h" -@interface XPRoomAnimationView () +@interface XPRoomAnimationView ()< +SVGAPlayerDelegate, +NIMBroadcastManagerDelegate, +XPRoomGiftBroadcastViewDelegate, +HWDMP4PlayDelegate, +XPRoomLuckyBigPrizeViewDelegate, +XPRoomGraffitiGiftAnimationViewDelegate, +XPRoomStarKitchenBannerViewDelegate, +PAGViewListener, +XPRoomAnchorRankBannerViewDelegate, +PIRoomGiftBroadcastWindowDelegate, +PIUniversalBannerViewDelegate, +HWDMP4PlayDelegate> ///展示的不同层级 ///最底层的 @property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView; @@ -161,6 +173,12 @@ @property (nonatomic, strong) NSMutableArray *roomLuckWinningBannerModels; @property (nonatomic, assign) BOOL isDisplayLuckWinningBanner; +///CP特效 +@property (nonatomic, strong) VAPView *cpVAPView; +@property (nonatomic, strong) NetImageView *avatarLoader; +@property (nonatomic, strong) NetImageView *cpAvatarLoader; +@property (nonatomic, strong) AttachmentModel *cpAttachment; + @end @implementation XPRoomAnimationView @@ -368,6 +386,16 @@ } 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.cpAttachment = attachment; + if (attachment.second == Custom_Message_Sub_CP_Gift) { + + } else if (attachment.second == Custom_Message_Sub_CP_Upgrade) { + + } else if (attachment.second == Custom_Message_Sub_CP_Binding) { + [self playCPBinding]; +// {"data":{"giftUrl":"https://image.pekolive.com/I Do.png","partitionId":2,"receiverAvatar":"https://img.molistar.xyz/default_avatar_molistar.png","roomUid":3238,"senderAvatar":"https://img.molistar.xyz/default_avatar_molistar.png"},"first":64,"second":643} + } } } } @@ -2497,6 +2525,45 @@ } } +#pragma mark - CP 礼物 +- (void)playCPBinding { + [self addSubview:self.cpVAPView]; + [self.cpVAPView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self); + make.top.mas_equalTo(146); + make.width.mas_equalTo(KScreenWidth); + make.height.mas_equalTo(230); + }]; + + NSString *filePath = [[NSBundle mainBundle] pathForResource:@"CP绑定" ofType:@"mp4"]; + [self.cpVAPView playHWDMP4:filePath delegate:self]; +} + +//provide the content for tags, maybe text or url string ... +- (NSString *)contentForVapTag:(NSString *)tag resource:(QGVAPSourceInfo *)info { + NSDictionary *extraInfo = @{@"[name1]" : @"你阿妈",//self.cpAttachment.data[@"你阿妈"], + @"[name2]" : @"你阿爸"}; + return extraInfo[tag]; +} + +//provide image for url from tag content +- (void)loadVapImageWithURL:(NSString *)urlStr context:(NSDictionary *)context completion:(VAPImageCompletionBlock)completionBlock { + dispatch_async(dispatch_get_main_queue(), ^{ + QGVAPSourceInfo *info = (QGVAPSourceInfo *)context[@"resource"]; + if ([info.contentTag isEqualToString:@"avatar1"] ) { + self.avatarLoader = [[NetImageView alloc] init]; + [self.avatarLoader loadImageWithUrl:self.cpAttachment.data[@"senderAvatar"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { + completionBlock(image, nil, urlStr); + }]; + } else { + self.cpAvatarLoader = [[NetImageView alloc] init]; + [self.cpAvatarLoader loadImageWithUrl:self.cpAttachment.data[@"receiverAvatar"] completion:^(UIImage * _Nullable image, NSURL * _Nonnull url) { + completionBlock(image, nil, urlStr); + }]; + } + }); +} + #pragma mark - 心愿礼物 - (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment { CGFloat x = random() % (int)(KScreenWidth - 200); @@ -2532,6 +2599,10 @@ #pragma mark - HWDMP4PlayDelegate //即将开始播放时询问,true马上开始播放,false放弃播放 - (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config { + if (container == self.cpVAPView) { + return YES; + } + CGFloat width = config.info.size.width; CGFloat height = config.info.size.height; @@ -2556,18 +2627,17 @@ [self playCarEffect:self.carEffectQueue.firstObject]; } } else if (container == self.vapGiftEffectView) { - - [self.vapGiftEffectView removeFromSuperview]; self.vapGiftEffectView = nil; if (self.isLargeGiftAnimating == YES) { self.isLargeGiftAnimating = NO; } - - } else if(container == self.luckyVapGiftEffectView) { [self.luckyVapGiftEffectView removeFromSuperview]; self.luckyVapGiftEffectView = nil; + } else if (container == self.cpVAPView) { + [self.cpVAPView removeFromSuperview]; + self.cpVAPView = nil; } }); } @@ -2604,6 +2674,11 @@ if (self.isLargeGiftAnimating == YES) { self.isLargeGiftAnimating = NO; } + + if (_cpVAPView) { + [self.cpVAPView removeFromSuperview]; + self.cpVAPView = nil; + } } #pragma mark - PAGViewListener /** @@ -2938,4 +3013,14 @@ } return _broadCastHieght; } + +- (VAPView *)cpVAPView { + if (!_cpVAPView) { + _cpVAPView = [[VAPView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)]; + _cpVAPView.contentMode = UIViewContentModeScaleAspectFill; + _cpVAPView.hwd_Delegate = self; + } + return _cpVAPView; +} + @end diff --git a/YuMi/Resources/cp/CP绑定.mp4 b/YuMi/Resources/cp/CP绑定.mp4 new file mode 100644 index 00000000..c88c85f8 Binary files /dev/null and b/YuMi/Resources/cp/CP绑定.mp4 differ