新增pag动效及首页bug修复
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
#import "PIFullScreenBannerAnimation.h"
|
||||
#import "XPTreasureFairyGiftView.h"
|
||||
#import "XPRoomTarrowBannerView.h"
|
||||
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate>
|
||||
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate, HWDMP4PlayDelegate, XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomGraffitiGiftAnimationViewDelegate, XPRoomStarKitchenBannerViewDelegate,PAGViewListener>
|
||||
///展示的不同层级
|
||||
///最底层的
|
||||
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
|
||||
@@ -118,6 +118,8 @@
|
||||
@property (nonatomic,strong) SVGAImageView *carEffectView;
|
||||
///座驾VAP特效
|
||||
@property (nonatomic, strong) VAPView *carVapEffectView;
|
||||
///座驾pag动效
|
||||
@property(nonatomic,strong) PAGView *carPagView;
|
||||
#pragma mark - 进房动画的
|
||||
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *enterEffectQueue;
|
||||
@property (nonatomic,strong) SVGAImageView *enterEffectView;
|
||||
@@ -157,15 +159,7 @@
|
||||
- (void)dealloc {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
if(self.giftEffectTimer != nil){
|
||||
dispatch_resume(self.giftEffectTimer);
|
||||
self.giftEffectTimer = nil;
|
||||
}
|
||||
|
||||
if(self.giftTimer != nil){
|
||||
dispatch_resume(self.giftTimer);
|
||||
self.giftTimer = nil;
|
||||
}
|
||||
}
|
||||
-(void)resumeTimer{
|
||||
if(self.giftEffectTimer != nil){
|
||||
@@ -177,6 +171,7 @@
|
||||
dispatch_resume(self.giftTimer);
|
||||
self.giftTimer = nil;
|
||||
}
|
||||
[self.giftPagView removeListener:self];
|
||||
}
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
self = [super init];
|
||||
@@ -457,7 +452,7 @@
|
||||
[self.animationListB addObject:giftNotifyInfo];
|
||||
}
|
||||
- (void)createCommonH5BannerAnimation:(PIBaseAnimationViewModel *)attatchment {
|
||||
|
||||
|
||||
CGFloat kscale = (CGFloat)55 / (CGFloat)375;
|
||||
self.isPlayOfB = YES;
|
||||
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
|
||||
@@ -489,12 +484,12 @@
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -503,7 +498,7 @@
|
||||
}];
|
||||
[tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
|
||||
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - 收到塔罗飘屏
|
||||
-(void)receiveTarotBanner:(AttachmentModel *)attachment{
|
||||
@@ -518,7 +513,7 @@
|
||||
}
|
||||
|
||||
- (void)createTarotBannerAnimation:(PIBaseAnimationViewModel *)attatchment {
|
||||
|
||||
|
||||
CGFloat kscale = (CGFloat)55 / (CGFloat)375;
|
||||
self.isPlayOfB = YES;
|
||||
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
|
||||
@@ -550,12 +545,12 @@
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -564,7 +559,7 @@
|
||||
}];
|
||||
[tarrowVeiw pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
|
||||
|
||||
|
||||
|
||||
}
|
||||
#pragma mark - 夺宝精灵横幅
|
||||
- (void)receiveTreasureFairyGiftHighLevel:(AttachmentModel *)attatchment {
|
||||
@@ -578,7 +573,7 @@
|
||||
[self createTreasureFairyBannerAnimation:giftModel];
|
||||
}
|
||||
[self.animationListB addObject:giftModel];
|
||||
|
||||
|
||||
}
|
||||
- (void)createTreasureFairyBannerAnimation:(PIBaseAnimationViewModel *)attatchment {
|
||||
self.isPlayOfB = YES;
|
||||
@@ -621,12 +616,12 @@
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -912,6 +907,26 @@
|
||||
|
||||
[self.vapParser parseWithURL:viewUrl completionBlock:^(NSString * _Nullable videoUrl) {
|
||||
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];
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
self.carVapEffectView.hidden = NO;
|
||||
if (self.carVapEffectView.superview == nil) {
|
||||
[self.middleLevelView addSubview:self.carVapEffectView];
|
||||
@@ -1009,12 +1024,12 @@
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
// if(self. isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -1113,12 +1128,12 @@
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
//
|
||||
// [self playAnimationWithModel];
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}
|
||||
}];
|
||||
@@ -1213,11 +1228,11 @@
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}];
|
||||
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
@@ -1272,11 +1287,11 @@
|
||||
if(self.animationListB.count > 0){
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
}];
|
||||
[anchorRankView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
||||
@@ -1505,8 +1520,8 @@
|
||||
GiftReceiveInfoModel *giftNotifyInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
///年度飘屏是广播 在tabbar中监听
|
||||
if (giftNotifyInfo.ceremonyGift)return;
|
||||
// if(giftNotifyInfo.isHomeShow == YES)return; ///房间外飘屏 在tabbar中监听
|
||||
// if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///自己的房间跨房间飘屏不用走
|
||||
// if(giftNotifyInfo.isHomeShow == YES)return; ///房间外飘屏 在tabbar中监听
|
||||
// if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///自己的房间跨房间飘屏不用走
|
||||
if (self.animationListA.count == 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
|
||||
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
|
||||
}
|
||||
@@ -1589,16 +1604,16 @@
|
||||
#pragma mark - 福袋中 四级奖品
|
||||
- (void)receiveLuckyGiftBigPrize:(AttachmentModel *)attachment {
|
||||
if ([self isInSudGame]) {return;}
|
||||
|
||||
PIBaseAnimationViewModel * prizeModel = [PIBaseAnimationViewModel modelWithDictionary:attachment.data];
|
||||
prizeModel.type = GiftBannerType_Lucky;
|
||||
prizeModel.isInRoomVisiable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag;
|
||||
|
||||
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
|
||||
[self createBigPrizeAnimation:prizeModel];
|
||||
}
|
||||
[self.animationListB addObject:prizeModel];
|
||||
|
||||
|
||||
PIBaseAnimationViewModel * prizeModel = [PIBaseAnimationViewModel modelWithDictionary:attachment.data];
|
||||
prizeModel.type = GiftBannerType_Lucky;
|
||||
prizeModel.isInRoomVisiable = attachment.second == Custom_Message_Sub_Room_Gift_LuckBag;
|
||||
|
||||
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
|
||||
[self createBigPrizeAnimation:prizeModel];
|
||||
}
|
||||
[self.animationListB addObject:prizeModel];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1624,17 +1639,17 @@
|
||||
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth / 2, luckyGiftEffectView.center.y)];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 6 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
[luckyGiftEffectView removeFromSuperview];
|
||||
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
self.isPlayOfB = NO;
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
|
||||
if (self.animationListB.count > 0) {
|
||||
[self.animationListB removeObjectAtIndex:0];
|
||||
}
|
||||
self.isPlayOfB = NO;
|
||||
// if(self.isAnimationListAFinish == YES){
|
||||
// self.isAnimationListAFinish = NO;
|
||||
// [self playAnimationWithModel];
|
||||
// return;
|
||||
// }
|
||||
[self playAnimationWithModel];
|
||||
});
|
||||
[luckyGiftEffectView pop_addAnimation:springAnimation forKey:@"nobleLevelUpspingOutAnimation"];
|
||||
}
|
||||
@@ -1662,13 +1677,13 @@
|
||||
}
|
||||
|
||||
-(void)playAnimationWithModel{
|
||||
// if(self.isAnimationListAFinish == YES)return;
|
||||
// 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;
|
||||
}
|
||||
@@ -1718,7 +1733,7 @@
|
||||
//如果是福袋礼物的话 就不用看他的价值了 只要有SVGA的话 就播放
|
||||
if (receiveInfo.displayGift.count > 0) {
|
||||
[receiveInfo.displayGift enumerateObjectsUsingBlock:^(GiftInfoModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.otherViewType == GiftOtherViewTypeMp4 && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
|
||||
if ((obj.otherViewType == GiftOtherViewTypeMp4 || obj.otherViewType == GiftOtherViewTypePag) && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
|
||||
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
|
||||
model.viewUrl = obj.viewUrl;
|
||||
model.avatar = receiveInfo.sendUserAvatar;
|
||||
@@ -1730,8 +1745,8 @@
|
||||
model.targetAvatar = receiveInfo.targetAvatar;
|
||||
model.targetNick = receiveInfo.targetNick;
|
||||
[self.svgaQueue addObject:model];
|
||||
|
||||
// [self.animationListA addObject:model];
|
||||
|
||||
// [self.animationListA addObject:model];
|
||||
} else if (obj.hasVggPic && roomInfor.hasAnimationEffect) {
|
||||
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
|
||||
model.viewUrl = obj.viewUrl;
|
||||
@@ -1744,8 +1759,8 @@
|
||||
model.targetAvatar = receiveInfo.targetAvatar;
|
||||
model.targetNick = receiveInfo.targetNick;
|
||||
[self.svgaQueue addObject:model];
|
||||
|
||||
// [self.animationListA addObject:model];
|
||||
|
||||
// [self.animationListA addObject:model];
|
||||
}
|
||||
}];
|
||||
}
|
||||
@@ -1761,7 +1776,7 @@
|
||||
}
|
||||
if (receiveInfo.targetUsers.count > 0 && receiveInfo.targetUids.count <= 0) {
|
||||
receiveInfo.targetUids = [receiveInfo.targetUsers valueForKeyPath:@"uid"];
|
||||
}
|
||||
}
|
||||
|
||||
NSInteger giftTotal = 0;
|
||||
if (receiveInfo.targetUids.count > 0) {
|
||||
@@ -1770,25 +1785,25 @@
|
||||
giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
|
||||
}
|
||||
|
||||
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
|
||||
if ((giftInfo.otherViewType == GiftOtherViewTypeMp4 || giftInfo.otherViewType == GiftOtherViewTypePag) && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
|
||||
receiveInfo.viewUrl = giftInfo.viewUrl;
|
||||
// [self.animationListA addObject:receiveInfo];
|
||||
// [self.animationListA addObject:receiveInfo];
|
||||
[self.svgaQueue addObject:receiveInfo];
|
||||
} else if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && roomInfor.hasAnimationEffect) {///SVGA动画
|
||||
receiveInfo.vggUrl = giftInfo.vggUrl;
|
||||
// [self.animationListA addObject:receiveInfo];
|
||||
// [self.animationListA addObject:receiveInfo];
|
||||
[self.svgaQueue addObject:receiveInfo];
|
||||
}
|
||||
}
|
||||
|
||||
// if (self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
|
||||
// [self createGiftBannerViewAnimation:self.animationListA.firstObject];
|
||||
// }
|
||||
// if (self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
|
||||
// [self createGiftBannerViewAnimation:self.animationListA.firstObject];
|
||||
// }
|
||||
|
||||
// if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
|
||||
// [self createGiftSvgaAnimation:self.svgaQueue.firstObject];
|
||||
//
|
||||
// }
|
||||
// if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
|
||||
// [self createGiftSvgaAnimation:self.svgaQueue.firstObject];
|
||||
//
|
||||
// }
|
||||
if (self.giftEffectTimer == nil && self.svgaQueue.count > 0) {
|
||||
[self startHandleGiftEffectTimer];
|
||||
}
|
||||
@@ -1820,89 +1835,97 @@
|
||||
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.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
[self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
[self playGiftEffectWithVapUrl:giftInfo.viewUrl];
|
||||
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 playGiftEffectWithVapUrl:giftInfo.viewUrl];
|
||||
}
|
||||
}
|
||||
if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
|
||||
[self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
[self playGiftEffect:giftInfo.vggUrl];
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo {
|
||||
|
||||
[self createGiftBroadcastViewAnimation:receiveInfo];
|
||||
|
||||
// GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
|
||||
// if (!giftInfo) {
|
||||
// giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
|
||||
// }
|
||||
// NSInteger giftTotal = 0;
|
||||
// if (receiveInfo.targetUids.count > 0) {
|
||||
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
|
||||
// } else {
|
||||
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
|
||||
// }
|
||||
// if (giftTotal >= 520) {
|
||||
// self.isPlayOfA = YES;
|
||||
// __block XPRoomGiftBannerView *view = [self.bannerDequePool anyObject];
|
||||
// if (view == nil) {
|
||||
// view = [[XPRoomGiftBannerView alloc] init];
|
||||
// [self.bannerVisiablePool addObject:view];
|
||||
// }else{
|
||||
// [self.bannerDequePool removeObject:view];
|
||||
// }
|
||||
// [self removeGiftBannerView:view];
|
||||
// [view configGiftBanner:receiveInfo users:[self makeBannerUsers]];
|
||||
// view.frame = CGRectMake(KScreenWidth, 80, KScreenWidth, 153);
|
||||
// [self.highLevleView addSubview:view];
|
||||
// POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
// springAnimation.springSpeed = 12;
|
||||
// springAnimation.springBounciness = 10.f;
|
||||
// springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
|
||||
// springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.frame.size.width / 2, view.center.y)];
|
||||
// @kWeakify(self);
|
||||
// [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
// @kStrongify(self);
|
||||
// if (finished) {
|
||||
// [self removeAnimation:view];
|
||||
// }
|
||||
// }];
|
||||
//
|
||||
// [springAnimation setAnimationDidStartBlock:^(POPAnimation *anim) {
|
||||
// @kStrongify(self);
|
||||
//
|
||||
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffectWithVapUrl:giftInfo.viewUrl];
|
||||
//// }
|
||||
//// if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffect:giftInfo.vggUrl];
|
||||
//// }
|
||||
// }];
|
||||
//
|
||||
// [view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
|
||||
// } else {
|
||||
//
|
||||
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && receiveInfo.viewUrl.length > 0) {//播放vap动效
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
||||
//// }
|
||||
//// if (receiveInfo.vggUrl.length > 0) {///如果有特效的话就播放特效
|
||||
////
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffect:receiveInfo.vggUrl];
|
||||
//// }
|
||||
// [self.animationListA removeObjectAtIndex:0];
|
||||
// }
|
||||
// GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
|
||||
// if (!giftInfo) {
|
||||
// giftInfo = [[XPGiftStorage shareStorage] findGiftInfo: receiveInfo.giftId];
|
||||
// }
|
||||
// NSInteger giftTotal = 0;
|
||||
// if (receiveInfo.targetUids.count > 0) {
|
||||
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice * receiveInfo.targetUids.count;
|
||||
// } else {
|
||||
// giftTotal = receiveInfo.giftNum * giftInfo.goldPrice;
|
||||
// }
|
||||
// if (giftTotal >= 520) {
|
||||
// self.isPlayOfA = YES;
|
||||
// __block XPRoomGiftBannerView *view = [self.bannerDequePool anyObject];
|
||||
// if (view == nil) {
|
||||
// view = [[XPRoomGiftBannerView alloc] init];
|
||||
// [self.bannerVisiablePool addObject:view];
|
||||
// }else{
|
||||
// [self.bannerDequePool removeObject:view];
|
||||
// }
|
||||
// [self removeGiftBannerView:view];
|
||||
// [view configGiftBanner:receiveInfo users:[self makeBannerUsers]];
|
||||
// view.frame = CGRectMake(KScreenWidth, 80, KScreenWidth, 153);
|
||||
// [self.highLevleView addSubview:view];
|
||||
// POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
|
||||
// springAnimation.springSpeed = 12;
|
||||
// springAnimation.springBounciness = 10.f;
|
||||
// springAnimation.fromValue = [NSValue valueWithCGPoint:view.center];
|
||||
// springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(view.frame.size.width / 2, view.center.y)];
|
||||
// @kWeakify(self);
|
||||
// [springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
||||
// @kStrongify(self);
|
||||
// if (finished) {
|
||||
// [self removeAnimation:view];
|
||||
// }
|
||||
// }];
|
||||
//
|
||||
// [springAnimation setAnimationDidStartBlock:^(POPAnimation *anim) {
|
||||
// @kStrongify(self);
|
||||
//
|
||||
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffectWithVapUrl:giftInfo.viewUrl];
|
||||
//// }
|
||||
//// if (giftInfo.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffect:giftInfo.vggUrl];
|
||||
//// }
|
||||
// }];
|
||||
//
|
||||
// [view pop_addAnimation:springAnimation forKey:@"spingOutAnimation"];
|
||||
// } else {
|
||||
//
|
||||
//// if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && receiveInfo.viewUrl.length > 0) {//播放vap动效
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffectWithVapUrl:receiveInfo.viewUrl];
|
||||
//// }
|
||||
//// if (receiveInfo.vggUrl.length > 0) {///如果有特效的话就播放特效
|
||||
////
|
||||
//// [self largeGiftStopCarEffect:giftInfo.goldPrice];
|
||||
//// [self playGiftEffect:receiveInfo.vggUrl];
|
||||
//// }
|
||||
// [self.animationListA removeObjectAtIndex:0];
|
||||
// }
|
||||
}
|
||||
|
||||
- (void)largeGiftStopCarEffect:(double)goldPrice {
|
||||
@@ -1910,6 +1933,7 @@
|
||||
self.isLargeGiftAnimating = YES;
|
||||
[self.carEffectView stopAnimation];
|
||||
[self.carVapEffectView stopHWDMP4];
|
||||
[self.carPagView stop];
|
||||
[self.carEffectQueue removeAllObjects];
|
||||
}
|
||||
}
|
||||
@@ -1932,14 +1956,14 @@
|
||||
}
|
||||
|
||||
|
||||
if(self.animationListB.count > 0){
|
||||
// self.isAnimationListAFinish = YES;
|
||||
[self playAnimationWithModel];
|
||||
return;
|
||||
}
|
||||
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
|
||||
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
|
||||
}
|
||||
if(self.animationListB.count > 0){
|
||||
// self.isAnimationListAFinish = YES;
|
||||
[self playAnimationWithModel];
|
||||
return;
|
||||
}
|
||||
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
|
||||
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1970,7 +1994,7 @@
|
||||
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
|
||||
[self.parser parseWithData:data cacheKey:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
|
||||
if (videoItem != nil) {
|
||||
|
||||
|
||||
self.giftEffectView.hidden = NO;
|
||||
if (self.giftEffectView.superview == nil) {
|
||||
[self.middleLevelView addSubview:self.giftEffectView];
|
||||
@@ -1998,16 +2022,16 @@
|
||||
self.giftEffectView.videoItem = videoItem;
|
||||
[self.giftEffectView startAnimation];
|
||||
}
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
self.giftEffectView.hidden = YES;
|
||||
}];
|
||||
} failureBlock:^(NSError * _Nonnull error) {
|
||||
self.giftEffectView.hidden = YES;
|
||||
}];
|
||||
return;
|
||||
|
||||
|
||||
};
|
||||
|
||||
[self.parser parseWithURL:[NSURL URLWithString:vggUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
if (videoItem != nil) {
|
||||
|
||||
|
||||
self.giftEffectView.hidden = NO;
|
||||
if (self.giftEffectView.superview == nil) {
|
||||
[self.middleLevelView addSubview:self.giftEffectView];
|
||||
@@ -2039,7 +2063,29 @@
|
||||
self.giftEffectView.hidden = YES;
|
||||
}];
|
||||
}
|
||||
|
||||
///播放礼物特效 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 {
|
||||
|
||||
@@ -2352,7 +2398,71 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
#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) {
|
||||
@@ -2609,8 +2719,17 @@
|
||||
- (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;
|
||||
}
|
||||
@end
|
||||
|
Reference in New Issue
Block a user