修复bug
This commit is contained in:
@@ -89,7 +89,8 @@
|
||||
@property (strong,nonatomic)NSMutableSet * bannerDequePool;
|
||||
///可见池
|
||||
@property (strong,nonatomic)NSMutableSet * bannerVisiablePool;
|
||||
|
||||
///礼物定时器 6s刷新一次
|
||||
@property (nonatomic,strong)dispatch_source_t giftEffectTimer;
|
||||
|
||||
|
||||
#pragma mark - 送礼物的动画的
|
||||
@@ -152,6 +153,15 @@
|
||||
- (void)dealloc {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
if(self.giftEffectTimer != nil){
|
||||
dispatch_resume(self.giftEffectTimer);
|
||||
self.giftEffectTimer = nil;
|
||||
}
|
||||
|
||||
if(self.giftTimer != nil){
|
||||
dispatch_resume(self.giftTimer);
|
||||
self.giftEffectTimer = nil;
|
||||
}
|
||||
}
|
||||
|
||||
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
||||
@@ -1628,13 +1638,37 @@
|
||||
// [self createGiftBannerViewAnimation:self.animationListA.firstObject];
|
||||
// }
|
||||
|
||||
if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
|
||||
[self createGiftSvgaAnimation:self.svgaQueue.firstObject];
|
||||
|
||||
// if(self.svgaQueue.count > 0 && self.isLargeGiftAnimating == NO){
|
||||
// [self createGiftSvgaAnimation:self.svgaQueue.firstObject];
|
||||
//
|
||||
// }
|
||||
if (self.giftEffectTimer == nil && self.svgaQueue.count > 0) {
|
||||
[self startHandleGiftEffectTimer];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///开启普通礼物特效定时器
|
||||
- (void)startHandleGiftEffectTimer {
|
||||
NSTimeInterval period = 6.0; //设置时间间隔 6秒是 1、单纯的svga 2.有横幅有svga 3、只有横幅
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
|
||||
dispatch_source_t _timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
||||
dispatch_source_set_timer(_timer, dispatch_walltime(NULL, 0), period * NSEC_PER_SEC, 0); //每秒执行
|
||||
@kWeakify(self);
|
||||
dispatch_source_set_event_handler(_timer, ^{
|
||||
@kStrongify(self)
|
||||
if (self.svgaQueue.count > 0) {
|
||||
dispatch_sync(dispatch_get_main_queue(), ^{
|
||||
GiftReceiveInfoModel * receiveModel = [self.svgaQueue firstObject];
|
||||
[self createGiftBannerViewAnimation:receiveModel];
|
||||
[self.svgaQueue removeObject:receiveModel];
|
||||
});
|
||||
}else {
|
||||
dispatch_source_cancel(_timer);
|
||||
self.giftEffectTimer = nil;
|
||||
}
|
||||
});
|
||||
dispatch_resume(_timer);
|
||||
self.giftEffectTimer = _timer;
|
||||
}
|
||||
-(void)createGiftSvgaAnimation:(GiftReceiveInfoModel *)receiveInfo{
|
||||
|
||||
GiftInfoModel *giftInfo = receiveInfo.gift != nil ? receiveInfo.gift : receiveInfo.giftInfo;
|
||||
@@ -1649,9 +1683,7 @@
|
||||
[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(), ^{
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
- (void)createGiftBannerViewAnimation:(GiftReceiveInfoModel *)receiveInfo {
|
||||
@@ -2039,13 +2071,7 @@
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
} else if (player == self.luckyGiftEffectView) {
|
||||
self.luckyGiftEffectView.hidden = YES;
|
||||
@@ -2139,13 +2165,7 @@
|
||||
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];
|
||||
}
|
||||
|
||||
|
||||
} else if(container == self.luckyVapGiftEffectView) {
|
||||
[self.luckyVapGiftEffectView removeFromSuperview];
|
||||
@@ -2172,13 +2192,7 @@
|
||||
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];
|
||||
}
|
||||
|
||||
} else if(container == self.luckyVapGiftEffectView) {
|
||||
[self.luckyVapGiftEffectView removeFromSuperview];
|
||||
self.luckyVapGiftEffectView = nil;
|
||||
|
Reference in New Issue
Block a user