feat: 基本cp绑定飘屏

This commit is contained in:
eggmanQQQ
2024-09-20 21:19:08 +08:00
parent f8d387aa84
commit eb46a2b002
5 changed files with 103 additions and 6 deletions

View File

@@ -525,6 +525,7 @@
54B9C6F72C9D8D05003F1CC5 /* 4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */; }; 54B9C6F72C9D8D05003F1CC5 /* 4.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */; };
54B9C6F82C9D8D05003F1CC5 /* 5.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */; }; 54B9C6F82C9D8D05003F1CC5 /* 5.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */; };
54B9C6F92C9D8D05003F1CC5 /* 3.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = 54B9C6F42C9D8D05003F1CC5 /* 3.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 */; }; 54C3895C2C215F5100FD47B1 /* XPHomeMineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */; };
54C3895F2C2189DD00FD47B1 /* XPHomeMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895E2C2189DD00FD47B1 /* XPHomeMinePresenter.m */; }; 54C3895F2C2189DD00FD47B1 /* XPHomeMinePresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C3895E2C2189DD00FD47B1 /* XPHomeMinePresenter.m */; };
54C389622C23BD1600FD47B1 /* HomeRankAvatarModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 54C389612C23BD1600FD47B1 /* HomeRankAvatarModel.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 = "<group>"; }; 54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 3.mp4; sourceTree = "<group>"; };
54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 4.mp4; sourceTree = "<group>"; }; 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 4.mp4; sourceTree = "<group>"; };
54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.mp4; sourceTree = "<group>"; }; 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = 5.mp4; sourceTree = "<group>"; };
54B9C6FA2C9DA4C4003F1CC5 /* CP绑定.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = "CP绑定.mp4"; sourceTree = "<group>"; };
54C3895A2C215F5100FD47B1 /* XPHomeMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMineViewController.h; sourceTree = "<group>"; }; 54C3895A2C215F5100FD47B1 /* XPHomeMineViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMineViewController.h; sourceTree = "<group>"; };
54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeMineViewController.m; sourceTree = "<group>"; }; 54C3895B2C215F5100FD47B1 /* XPHomeMineViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeMineViewController.m; sourceTree = "<group>"; };
54C3895D2C2189DD00FD47B1 /* XPHomeMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMinePresenter.h; sourceTree = "<group>"; }; 54C3895D2C2189DD00FD47B1 /* XPHomeMinePresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeMinePresenter.h; sourceTree = "<group>"; };
@@ -6485,6 +6487,7 @@
54FFD3802C9BD12600DE61E5 /* cp */ = { 54FFD3802C9BD12600DE61E5 /* cp */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
54B9C6FA2C9DA4C4003F1CC5 /* CP绑定.mp4 */,
54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */, 54B9C6F42C9D8D05003F1CC5 /* 3.mp4 */,
54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */, 54B9C6F52C9D8D05003F1CC5 /* 4.mp4 */,
54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */, 54B9C6F62C9D8D05003F1CC5 /* 5.mp4 */,
@@ -11159,6 +11162,7 @@
E80EC84628ACD84000D133C5 /* emoji_98@2x.png in Resources */, E80EC84628ACD84000D133C5 /* emoji_98@2x.png in Resources */,
E80EC84728ACD84000D133C5 /* emoji_104@2x.png in Resources */, E80EC84728ACD84000D133C5 /* emoji_104@2x.png in Resources */,
E80EC83328ACD84000D133C5 /* emoji_136@2x.png in Resources */, E80EC83328ACD84000D133C5 /* emoji_136@2x.png in Resources */,
54B9C6FB2C9DA4C4003F1CC5 /* CP绑定.mp4 in Resources */,
E80EC82628ACD84000D133C5 /* emoji_10@2x.png in Resources */, E80EC82628ACD84000D133C5 /* emoji_10@2x.png in Resources */,
E80EC82C28ACD84000D133C5 /* emoji_59@2x.png in Resources */, E80EC82C28ACD84000D133C5 /* emoji_59@2x.png in Resources */,
E80EC81A28ACD84000D133C5 /* emoji_161@2x.png in Resources */, E80EC81A28ACD84000D133C5 /* emoji_161@2x.png in Resources */,

View File

@@ -64,6 +64,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_LuckyBag = 61, CustomMessageType_LuckyBag = 61,
///发现萌新 ///发现萌新
CustomMessageType_FindNew = 62, CustomMessageType_FindNew = 62,
/// CP 礼物
CustomMessageType_CP = 64,
///塔罗 ///塔罗
CustomMessageType_Tarot = 71, CustomMessageType_Tarot = 71,
///相亲 ///相亲
@@ -709,6 +711,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageTypeMoneyFlow) {
Custom_Message_Sub_Money_Flow = 1110, 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<NIMCustomAttachment> @interface AttachmentModel : PIBaseModel<NIMCustomAttachment>
@property (nonatomic,assign) int first; @property (nonatomic,assign) int first;
@property (nonatomic,assign) int second; @property (nonatomic,assign) int second;

View File

@@ -389,7 +389,7 @@ HWDMP4PlayDelegate>
if (self.userInfo.relationUserVO.showCpAnim && self.userInfo.relationUserVO.cpLevel >= 3) { if (self.userInfo.relationUserVO.showCpAnim && self.userInfo.relationUserVO.cpLevel >= 3) {
[self.view addSubview:self.vapView]; [self.view addSubview:self.vapView];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@(self.userInfo.relationUserVO.cpLevel).stringValue ofType:@"mp4"]; NSString *filePath = [[NSBundle mainBundle] pathForResource:@(self.userInfo.relationUserVO.cpLevel).stringValue ofType:@"mp4"];
[self.vapView playHWDMP4:filePath delegate:self];//viewview [self.vapView playHWDMP4:filePath delegate:self];
} }
} }

View File

@@ -71,7 +71,19 @@
#import "LuckyGiftWinningBannerView.h" #import "LuckyGiftWinningBannerView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate,PAGViewListener,XPRoomAnchorRankBannerViewDelegate,PIRoomGiftBroadcastWindowDelegate,PIUniversalBannerViewDelegate> @interface XPRoomAnimationView ()<
SVGAPlayerDelegate,
NIMBroadcastManagerDelegate,
XPRoomGiftBroadcastViewDelegate,
HWDMP4PlayDelegate,
XPRoomLuckyBigPrizeViewDelegate,
XPRoomGraffitiGiftAnimationViewDelegate,
XPRoomStarKitchenBannerViewDelegate,
PAGViewListener,
XPRoomAnchorRankBannerViewDelegate,
PIRoomGiftBroadcastWindowDelegate,
PIUniversalBannerViewDelegate,
HWDMP4PlayDelegate>
/// ///
/// ///
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView; @property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
@@ -161,6 +173,12 @@
@property (nonatomic, strong) NSMutableArray *roomLuckWinningBannerModels; @property (nonatomic, strong) NSMutableArray *roomLuckWinningBannerModels;
@property (nonatomic, assign) BOOL isDisplayLuckWinningBanner; @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 @end
@implementation XPRoomAnimationView @implementation XPRoomAnimationView
@@ -368,6 +386,16 @@
} else if (attachment.first == CustomMessageType_Super_Gift && } else if (attachment.first == CustomMessageType_Super_Gift &&
attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins_ALL_Room) { attachment.second == Custom_Message_Sub_Super_Gift_Winning_Coins_ALL_Room) {
[self receiveLuckGiftBanner:attachment]; [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 - #pragma mark -
- (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment { - (void)receiveRoomWishGiftCelebrate:(AttachmentModel *)attachment {
CGFloat x = random() % (int)(KScreenWidth - 200); CGFloat x = random() % (int)(KScreenWidth - 200);
@@ -2532,6 +2599,10 @@
#pragma mark - HWDMP4PlayDelegate #pragma mark - HWDMP4PlayDelegate
//truefalse //truefalse
- (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config { - (BOOL)shouldStartPlayMP4:(VAPView *)container config:(QGVAPConfigModel *)config {
if (container == self.cpVAPView) {
return YES;
}
CGFloat width = config.info.size.width; CGFloat width = config.info.size.width;
CGFloat height = config.info.size.height; CGFloat height = config.info.size.height;
@@ -2556,18 +2627,17 @@
[self playCarEffect:self.carEffectQueue.firstObject]; [self playCarEffect:self.carEffectQueue.firstObject];
} }
} else if (container == self.vapGiftEffectView) { } else if (container == self.vapGiftEffectView) {
[self.vapGiftEffectView removeFromSuperview]; [self.vapGiftEffectView removeFromSuperview];
self.vapGiftEffectView = nil; self.vapGiftEffectView = nil;
if (self.isLargeGiftAnimating == YES) { if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO; self.isLargeGiftAnimating = NO;
} }
} else if(container == self.luckyVapGiftEffectView) { } else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview]; [self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil; self.luckyVapGiftEffectView = nil;
} else if (container == self.cpVAPView) {
[self.cpVAPView removeFromSuperview];
self.cpVAPView = nil;
} }
}); });
} }
@@ -2604,6 +2674,11 @@
if (self.isLargeGiftAnimating == YES) { if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO; self.isLargeGiftAnimating = NO;
} }
if (_cpVAPView) {
[self.cpVAPView removeFromSuperview];
self.cpVAPView = nil;
}
} }
#pragma mark - PAGViewListener #pragma mark - PAGViewListener
/** /**
@@ -2938,4 +3013,14 @@
} }
return _broadCastHieght; 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 @end

Binary file not shown.