修复bug

This commit is contained in:
liyuhua
2024-01-03 16:58:16 +08:00
parent 5c057821a7
commit 10a1e6e09e
21 changed files with 313 additions and 133 deletions

View File

@@ -111,8 +111,7 @@
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
///
@property (nonatomic,strong) NSMutableArray *compoundGiftQueue;
///
@property (nonatomic,assign) BOOL isLargeGiftAnimating;
@@ -183,6 +182,8 @@
self.delegate = delegate;
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
@@ -1178,16 +1179,18 @@
#pragma mark -
- (void)receiveGiftCompound:(AttachmentModel *)attachment {
if ([self isInSudGame]) {return;}
if (self.compoundGiftQueue.count == 0) {
[self createGiftCompoundBannerAnimation:attachment];
PIBaseAnimationViewModel *magicModel =[PIBaseAnimationViewModel new];
magicModel.data = attachment.data;
magicModel.type = GiftBannerType_Magic_House;
if(self.animationListB.count == 0 && self.isPlayOfB == NO){
[self createGiftCompoundBannerAnimation:magicModel];
}
[self.compoundGiftQueue addObject:attachment];
[self.animationListB addObject:magicModel];
}
- (void)createGiftCompoundBannerAnimation:(AttachmentModel *)attachment {
- (void)createGiftCompoundBannerAnimation:(PIBaseAnimationViewModel *)attachment {
self.isPlayOfB = YES;
XPRoomGiftCompoundView *compoundGiftView = [[XPRoomGiftCompoundView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)];
compoundGiftView.compoundGiftInfo = attachment.data;
[self.middleLevelView addSubview:compoundGiftView];
@@ -1210,13 +1213,16 @@
@kStrongify(self);
if (finished) {
[compoundGiftView removeFromSuperview];
if (self.compoundGiftQueue.count > 0) {
[self.compoundGiftQueue removeObjectAtIndex:0];
}
if (self.compoundGiftQueue.count > 0) {
[self createGiftCompoundBannerAnimation:self.compoundGiftQueue.firstObject];
self.isPlayOfB = NO;
if(self.animationListB.count > 0){
[self.animationListB removeObjectAtIndex:0];
}
// if(self.isAnimationListAFinish == YES){
// self.isAnimationListAFinish = NO;
// [self playAnimationWithModel];
// return;
// }
[self playAnimationWithModel];
}
}];
[compoundGiftView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
@@ -1619,7 +1625,7 @@
self.isLuckyGiftAnimation = YES;
XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 60)];
XPRoomLuckyBigPrizeView * luckyGiftEffectView = [[XPRoomLuckyBigPrizeView alloc] initWithFrame:CGRectMake(KScreenWidth, top, 375, 71)];
luckyGiftEffectView.delegate = self;
[self.highLevleView addSubview:luckyGiftEffectView];
luckyGiftEffectView.giftInfo = prizeModel;
@@ -1629,19 +1635,35 @@
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:luckyGiftEffectView.center];
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];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 7 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(0, luckyGiftEffectView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, luckyGiftEffectView.center.y)];
moveAnimation.beginTime = CACurrentMediaTime();
moveAnimation.duration = 0.5;
moveAnimation.repeatCount = 1;
moveAnimation.removedOnCompletion = YES;
@kWeakify(self);
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
@kStrongify(self);
if (finished) {
[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];
}
}];
[luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
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"];
}
@@ -1665,6 +1687,8 @@
[self createTarotBannerAnimation:model];
}else if(model.type == GiftBannerType_Common_H5){
[self createCommonH5BannerAnimation:model];
}else if(model.type == GiftBannerType_Magic_House){
[self createGiftCompoundBannerAnimation:model];
}
}
@@ -1699,18 +1723,35 @@
[self createTarotBannerAnimation:model];
}else if(model.type == GiftBannerType_Common_H5){
[self createCommonH5BannerAnimation:model];
}else if(model.type == GiftBannerType_Magic_House){
[self createGiftCompoundBannerAnimation:model];
}
}
#pragma mark - XPRoomLuckyBigPrizeViewDelegate
- (void)xPRoomLuckyBigPrizeView:(XPRoomLuckyBigPrizeView *)view luckyGiftInfo:(PIBaseAnimationViewModel *)giftInfo {
if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) {
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
id isShowBroadcastView = [[NSUserDefaults standardUserDefaults]valueForKey:@"kSaveLuckSelectState"];
if(isShowBroadcastView == nil){
PIRoomGiftBroadcastWindow *broadcastView = [[PIRoomGiftBroadcastWindow alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, KScreenHeight)];
broadcastView.isLuck = YES;
broadcastView.roodUid = giftInfo.roomUid;
broadcastView.roomName = giftInfo.roomTitle;
broadcastView.delegate = self;
[kWindow addSubview:broadcastView];
return;
}
if (!giftInfo.isInRoomVisiable && giftInfo.roomUid.length > 0 && giftInfo.roomUid.integerValue != self.delegate.getRoomInfo.uid) {
[self.delegate exitRoom];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[XPRoomViewController openRoom:giftInfo.roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
});
}
}
#pragma mark -
@@ -2590,13 +2631,6 @@
- (NSMutableArray *)compoundGiftQueue {
if (!_compoundGiftQueue) {
_compoundGiftQueue = [NSMutableArray array];
}
return _compoundGiftQueue;
}
- (NSMutableArray<NSDictionary *> *)carEffectQueue {