糖果树送礼物的横幅 购买糖果
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user