飘屏优化

This commit is contained in:
liyuhua
2023-09-14 11:16:47 +08:00
parent 884482b8ae
commit cafd609cfc
50 changed files with 698 additions and 70 deletions

View File

@@ -61,6 +61,7 @@
#import "PIFullScreenBannerAnimation.h"
#import "XPSkillCardPlayerManager.h"
#import "XPTreasureFairyGiftView.h"
#import "XPRoomTarrowBannerView.h"
@interface PIFullScreenBannerAnimation()<XPRoomGiftBroadcastViewDelegate,XPRoomLuckyBigPrizeViewDelegate,XPRoomLicneseHourRankViewDelegate, XPRoomStarKitchenBannerViewDelegate>
/// PresentAchieveAbstractMatrix
@property(nonatomic,strong) NSMutableArray<GiftReceiveInfoModel *> *animationListA;
@@ -179,6 +180,10 @@
[self createLicneseHourRankAnimation:model];
}else if(model.type == GiftBannerType_Fairy){
[self createTreasureFairyBannerAnimation:model];
}else if(model.type == GiftBannerType_Tarrow){
[self createBigPrizeAnimation:model];
}else if(model.type == GiftBannerType_Common_H5){
[self createCommonH5BannerAnimation:model];
}
}
@@ -206,10 +211,131 @@
[self createLicneseHourRankAnimation:model];
}else if(model.type == GiftBannerType_Fairy){
[self createTreasureFairyBannerAnimation:model];
}else if(model.type == GiftBannerType_Tarrow){
[self createBigPrizeAnimation:model];
}else if(model.type == GiftBannerType_Common_H5){
[self createCommonH5BannerAnimation:model];
}
}
#pragma mark - h5
-(void)receiveCommonH5Banner:(AttachmentModel *)attachment{
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 ? (190 + 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.giftInfo = attatchment;
[kWindow 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)receiveTarotBanner:(AttachmentModel *)attachment{
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 ? (190 + 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;
[kWindow 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 {
PIBaseAnimationViewModel *giftModel = [PIBaseAnimationViewModel new];