去掉房间内的动画

This commit is contained in:
liyuhua
2023-08-08 16:37:36 +08:00
parent 0a98eb1873
commit 6d9d005ff0
8 changed files with 170 additions and 192 deletions

View File

@@ -358,7 +358,7 @@
- (void)createStarKitchenBannerAnimation:(PIBaseAnimationViewModel *)attacment{
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
XPRoomStarKitchenBannerView *starKitchenView = [[XPRoomStarKitchenBannerView alloc]initWithFrame:CGRectMake(0, top, KScreenWidth, kGetScaleWidth(60))];
starKitchenView.isSvga = attacment.second == Custom_Message_Sub_Star_Kitchen_Server;
XPRoomStarKitchenModel *starModel = [XPRoomStarKitchenModel modelWithDictionary:attacment.data];
@@ -758,7 +758,7 @@
- (void)createCandyTreeBannerAnimation:(PIBaseAnimationViewModel *)attatchment {
CGFloat kscale = (CGFloat)60 / (CGFloat)375;
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + 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;
@@ -862,7 +862,7 @@
- (void)createNobleLevelUpBannerAnimation:(PIBaseAnimationViewModel *)model {
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
XPRoomNobleLevelUpView *nobleLevelUpView = [[XPRoomNobleLevelUpView alloc] initWithFrame:CGRectMake(KScreenWidth, top, KScreenWidth, 90)];
nobleLevelUpView.nobleInfo = model.data;
@@ -964,7 +964,7 @@
}
- (void)createLicneseHourRankAnimation:(PIBaseAnimationViewModel *)attachment {
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
XPRoomLicneseHourRankView *anchorRankView = [[XPRoomLicneseHourRankView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 60)];
anchorRankView.delegate = self;
anchorRankView.licneseRankInfo = [RoomHalfHourRankModel modelWithDictionary:attachment.data];
@@ -1023,7 +1023,7 @@
}
- (void)createAnchorHourRankAnimation:(PIBaseAnimationViewModel *)attachment {
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
XPRoomAnchorRankBannerView *anchorRankView = [[XPRoomAnchorRankBannerView alloc] initWithFrame:CGRectMake(KScreenWidth,top, KScreenWidth, 60)];
anchorRankView.anchorRankInfo = [RoomHalfHourRankModel modelWithDictionary:attachment.data];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gotoTopRankAnchorRoom:)];
@@ -1283,7 +1283,7 @@
///广 tabbar
if (giftNotifyInfo.ceremonyGift)return;
// if(giftNotifyInfo.isHomeShow == YES)return; /// tabbar
if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///
// if(giftNotifyInfo.roomUid == self.delegate.getRoomInfo.uid)return; ///
if (self.animationListA.count == 0 && self.isPlayOfB == NO && self.isPlayOfA == NO) {
[self createGiftBroadcastViewAnimation:giftNotifyInfo];
}
@@ -1384,7 +1384,7 @@
- (void)createBigPrizeAnimation:(PIBaseAnimationViewModel *)prizeModel {
self.isPlayOfB = YES;
CGFloat top = self.isPlayOfA == YES ? 215 : (kNavigationHeight + 15);
CGFloat top = self.isPlayOfA == YES ? (190 + statusbarHeight) : (kNavigationHeight + 15);
self.isLuckyGiftAnimation = YES;
@@ -1537,18 +1537,18 @@
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && 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];
@@ -1586,69 +1586,72 @@
}
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)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];
[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];
// }
// if (receiveInfo.vggUrl.length > 0) {///
// [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];
// }
// }];
//
// [self largeGiftStopCarEffect:giftInfo.goldPrice];
// [self playGiftEffect:receiveInfo.vggUrl];
// }
[self.animationListA removeObjectAtIndex:0];
}
// [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 {
@@ -1719,37 +1722,37 @@
make.height.mas_equalTo(KScreenHeight);
}];
}
// NSString *baseFileName = @"/GiftSvga";
// NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl];
// NSFileManager *fileManager = [NSFileManager defaultManager];
// if ([fileManager fileExistsAtPath:filePath]){
// NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
// [self.parser parseWithData:data cacheKey:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
// if (videoItem != nil) {
// 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];
// }
// } failureBlock:^(NSError * _Nonnull error) {
// self.giftEffectView.hidden = YES;
// }];
// return;
//
// };
NSString *baseFileName = @"/GiftSvga";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:nil completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
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];
}
} failureBlock:^(NSError * _Nonnull error) {
self.giftEffectView.hidden = YES;
}];
return;
};
[self.parser parseWithURL:[NSURL URLWithString:vggUrl] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
if (videoItem != nil) {
@@ -1817,37 +1820,37 @@
}];
}
// NSString *baseFileName = @"/GiftSvga";
// NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl.absoluteString];
// NSFileManager *fileManager = [NSFileManager defaultManager];
// if ([fileManager fileExistsAtPath:filePath]){
// NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
// [self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
// if (videoItem != nil) {
// 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;
//
// };
NSString *baseFileName = @"/GiftSvga";
NSString *filePath = [[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:baseFileName] stringByAppendingPathComponent:vggUrl.absoluteString];
NSFileManager *fileManager = [NSFileManager defaultManager];
if ([fileManager fileExistsAtPath:filePath]){
NSData *data=[NSData dataWithContentsOfFile:filePath options:0 error:NULL];
[self.parser parseWithData:data cacheKey:@"" completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
if (videoItem != nil) {
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:vggUrl completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {