修复bug

This commit is contained in:
liyuhua
2023-07-21 14:07:04 +08:00
parent e59ece7222
commit bea4ee9c6c
42 changed files with 821 additions and 581 deletions

View File

@@ -68,6 +68,7 @@
@property (nonatomic,strong) XPRoomAnimationHitView * middleLevelView;
///
@property (nonatomic,strong) XPRoomAnimationHitView * highLevleView;
@property(nonatomic,strong) UIStackView *highSTackView;
///
@property (strong, nonatomic) SVGAParser *parser;
///VAP
@@ -141,6 +142,7 @@
@property(nonatomic,assign) BOOL isPlayOfB;
///animationListAanimationListBanimationListAanimationListB
@property(nonatomic,assign) BOOL isAnimationListAFinish;
@property(nonatomic,strong) NSMutableArray *svgaQueue;
@end
@@ -290,9 +292,9 @@
} else {
[self receiveGift:receiveInfo];
}
} else if (attachment.first == CustomMessageType_LuckyBag) {//
} else if (attachment.first == CustomMessageType_LuckyBag ) {//
[self receiveLuckyGiftBigPrize:attachment];
} else if (attachment.first == CustomMessageType_Look_Love && (attachment.second == Custom_Message_Sub_Look_Love_InRoom_NeedAllMicSend || attachment.second == Custom_Message_Sub_Look_Love_AllRoom_Notify) ) {//
} else if (attachment.first == CustomMessageType_Look_Love && (attachment.second == Custom_Message_Sub_Look_Love_AllRoom_Notify) ) {//
[self receiveCandyTreeGiftHighLevle:attachment];
} else if (attachment.first == CustomMessageType_Car_Notify && attachment.second == Custom_Message_Sub_Car_EnterRoom ) {//
[self receiveDriveCarEnterRoom:attachment];
@@ -784,12 +786,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];
}
}];
@@ -1408,16 +1410,19 @@
moveAnimation.removedOnCompletion = YES;
[moveAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
[luckyGiftEffectView removeFromSuperview];
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
self.isPlayOfB = NO;
if(self.isAnimationListAFinish == YES){
self.isAnimationListAFinish = NO;
if (self.animationListB.count > 0) {
[self.animationListB removeObjectAtIndex:0];
}
self.isPlayOfB = NO;
if(self.isAnimationListAFinish == YES){
self.isAnimationListAFinish = NO;
[self playAnimationWithModel];
return;
}
[self playAnimationWithModel];
return;
}
[self playAnimationWithModel];
}];
[luckyGiftEffectView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
@@ -1446,7 +1451,10 @@
if(self.isAnimationListAFinish == YES)return;
if(self.animationListB.count <= 0){
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
});
}
return;
}
@@ -1493,16 +1501,34 @@
if (obj.otherViewType == GiftOtherViewTypeMp4 && obj.viewUrl && obj.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.viewUrl = obj.viewUrl;
[self.animationListA addObject:model];
model.avatar = receiveInfo.sendUserAvatar;
model.gift = obj;
model.giftNum = [obj.giftNum integerValue];;
model.nick = receiveInfo.nick;
model.targetUids = receiveInfo.targetUids;
model.isBatch = receiveInfo.isBatch;
model.targetAvatar = receiveInfo.targetAvatar;
model.targetNick = receiveInfo.targetNick;
[self.svgaQueue addObject:model];
// [self.animationListA addObject:model];
} else if (obj.hasVggPic && roomInfor.hasAnimationEffect) {
GiftReceiveInfoModel * model = [[GiftReceiveInfoModel alloc] init];
model.vggUrl = obj.vggUrl;
[self.animationListA addObject:model];
model.viewUrl = obj.viewUrl;
model.avatar = receiveInfo.sendUserAvatar;
model.gift = obj;
model.giftNum = [obj.giftNum integerValue];;
model.nick = receiveInfo.nick;
model.targetUids = receiveInfo.targetUids;
model.isBatch = receiveInfo.isBatch;
model.targetAvatar = receiveInfo.targetAvatar;
model.targetNick = receiveInfo.targetNick;
[self.svgaQueue addObject:model];
// [self.animationListA addObject:model];
}
}];
}
} else {
}
} else {
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
@@ -1527,18 +1553,52 @@
if (giftInfo.otherViewType == GiftOtherViewTypeMp4 && giftInfo.viewUrl.length > 0 && roomInfor.hasAnimationEffect) {
receiveInfo.viewUrl = giftInfo.viewUrl;
[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.svgaQueue addObject:receiveInfo];
}
}
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];
}
}
-(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.hasVggPic && giftInfo.vggUrl.length > 0 && [self.delegate getRoomInfo].hasAnimationEffect) {
[self largeGiftStopCarEffect:giftInfo.goldPrice];
[self playGiftEffect:giftInfo.vggUrl];
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(6 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
if (self.isLargeGiftAnimating == YES) {
self.isLargeGiftAnimating = NO;
}
if(self.svgaQueue.count > 0){
[self.svgaQueue removeObjectAtIndex:0];
}
if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
[self createGiftSvgaAnimation:self.svgaQueue.firstObject];
}
});
}
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo {
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
@@ -1580,34 +1640,35 @@
[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];
}
// 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];
}
// 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 {
if ([ClientConfig shareConfig].configInfo.hideCarEffectGiftPrice <= goldPrice) {
self.isLargeGiftAnimating = YES;
[self.carEffectView stopAnimation];
[self.carVapEffectView stopHWDMP4];
[self.carEffectQueue removeAllObjects];
@@ -1625,19 +1686,24 @@
moveAnimation.removedOnCompletion = YES;
moveAnimation.completionBlock = ^(POPAnimation *anim, BOOL finished) {
if(finished){
view.frame = CGRectMake(KScreenWidth, 100, KScreenWidth, 0);;
[view removeFromSuperview];
self.isPlayOfA = NO;
if(self.animationListA.count > 0){
[self.animationListA removeObjectAtIndex:0];
}
if(self.animationListB.count > 0){
self.isAnimationListAFinish = YES;
[self playAnimationACompletion];
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 playAnimationACompletion];
return;
}
if(self.animationListA.count > 0 && self.isPlayOfB == NO && self.isPlayOfA == NO){
[self createGiftBannerViewAnimation:self.animationListA.firstObject];
}
}
} ;
[view pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
@@ -1659,6 +1725,7 @@
/// SVGA
- (void)playGiftEffect:(NSString *)vggUrl {
if ([self isInSudGame]) {return;}
self.isLargeGiftAnimating = YES;
self.giftEffectView.hidden = NO;
if (self.giftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.giftEffectView];
@@ -1727,6 +1794,7 @@
/// vap
- (void)playGiftEffectWithVapUrl:(NSString *)vapUrl {
self.isLargeGiftAnimating = YES;
self.vapGiftEffectView.hidden = NO;
if (self.vapGiftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.vapGiftEffectView];
@@ -1865,9 +1933,8 @@
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
if (player == self.giftEffectView) {
self.giftEffectView.hidden = YES;
if (self.isLargeGiftAnimating) {
self.isLargeGiftAnimating = NO;
}
} else if (player == self.luckyGiftEffectView) {
self.luckyGiftEffectView.hidden = YES;
} else if(player == self.carEffectView) {
@@ -1953,11 +2020,12 @@
[self playCarEffect:self.carEffectQueue.firstObject];
}
} else if (container == self.vapGiftEffectView) {
if (self.isLargeGiftAnimating) {
self.isLargeGiftAnimating = NO;
}
[self.vapGiftEffectView removeFromSuperview];
self.vapGiftEffectView = nil;
} else if(container == self.luckyVapGiftEffectView) {
[self.luckyVapGiftEffectView removeFromSuperview];
self.luckyVapGiftEffectView = nil;
@@ -2237,4 +2305,11 @@
}
return _animationListB;
}
- (NSMutableArray *)svgaQueue{
if(!_svgaQueue){
_svgaQueue = [NSMutableArray array];
}
return _svgaQueue;
}
@end