糖果树送礼物的横幅 购买糖果

This commit is contained in:
fengshuo
2021-12-10 19:19:02 +08:00
parent 5d0f14a3a2
commit 2a1e90dbe5
47 changed files with 1615 additions and 47 deletions

View File

@@ -30,6 +30,7 @@
///View
#import "XPRoomGiftBannerView.h"
#import "XPRoomGiftBroadcastView.h"
#import "XPRoomCandyGiftView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate, NIMChatManagerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate>
@@ -71,6 +72,8 @@
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftReuseArray;
///
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
///
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
@end
@implementation XPRoomAnimationView
@@ -154,11 +157,56 @@
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_LuckyBag) {//
[self receiveLuckyGiftBigPrize:attachment];
} else if (attachment.first == CustomMessageType_Candy_Tree || attachment.second == Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend ) {//
[self receiveCandyTreeGiftHighLevle:attachment];
}
}
}
}
#pragma mark -
- (void)receiveCandyTreeGiftHighLevle:(AttachmentModel *)attatchment {
if (self.candyTreegiftQueue.count == 0) {
[self createCandyTreeBannerAnimation:attatchment.data];
}
[self.candyTreegiftQueue addObject:attatchment.data];
}
- (void)createCandyTreeBannerAnimation:(NSDictionary *)dic {
XPRoomCandyGiftView *candyTreeView = [[XPRoomCandyGiftView alloc] initWithFrame:CGRectMake(KScreenWidth, kNavigationHeight + 15, KScreenWidth, 45)];
candyTreeView.candyInfo = dic;
[self.middleLevelView addSubview:candyTreeView];
POPSpringAnimation *springAnimation = [POPSpringAnimation animationWithPropertyNamed:kPOPViewCenter];
springAnimation.springSpeed = 12;
springAnimation.springBounciness = 10.f;
springAnimation.fromValue = [NSValue valueWithCGPoint:candyTreeView.center];
springAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(candyTreeView.frame.size.width / 2, candyTreeView.center.y)];
[springAnimation setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
if (finished) {
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(candyTreeView.frame.size.width / 2, candyTreeView.center.y)];
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth/2, candyTreeView.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) {
[candyTreeView removeFromSuperview];
[self.candyTreegiftQueue removeObjectAtIndex:0];
if (self.candyTreegiftQueue.count > 0) {
[self createCandyTreeBannerAnimation:self.candyTreegiftQueue.firstObject];
}
}
}];
[candyTreeView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
}
}];
[candyTreeView pop_addAnimation:springAnimation forKey:@"candyTreespingOutAnimation"];
}
#pragma mark -
- (void)receiveGiftHandleSendGiftAnimation:(AttachmentModel *)attachment {
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
@@ -814,4 +862,11 @@
return _giftVisibleArray;
}
- (NSMutableArray *)candyTreegiftQueue {
if (!_candyTreegiftQueue) {
_candyTreegiftQueue = [NSMutableArray array];
}
return _candyTreegiftQueue;
}
@end