在多个视图的 dismissBanner 方法中新增日志输出,以便于调试和监控动画完成状态;在 RoomAnimationView 中新增 ensureDebugViewsExist 方法,确保调试视图的存在并优化调试信息的输出;在 inserBannerModelToQueue 方法中添加参数验证和调试信息,提升代码的可读性和调试能力。
This commit is contained in:
@@ -77,12 +77,16 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismissBanner {
|
- (void)dismissBanner {
|
||||||
|
NSLog(@"🚨 GameUniversalBannerView dismissBanner 被调用");
|
||||||
self.alreadyCancel = YES;
|
self.alreadyCancel = YES;
|
||||||
[self pop_removeAllAnimations]; // 停止所有动画
|
[self pop_removeAllAnimations]; // 停止所有动画
|
||||||
|
|
||||||
[self popLeaveAnimation:^(bool finished) {
|
[self popLeaveAnimation:^(bool finished) {
|
||||||
|
NSLog(@"🚨 GameUniversalBannerView 动画完成,调用回调");
|
||||||
if (self.completeDisplay) {
|
if (self.completeDisplay) {
|
||||||
self.completeDisplay();
|
self.completeDisplay();
|
||||||
|
} else {
|
||||||
|
NSLog(@"🚨 警告: completeDisplay 回调为空");
|
||||||
}
|
}
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
}];
|
}];
|
||||||
|
@@ -133,11 +133,15 @@ exitCurrentRoom:(void(^)(void))exit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismissBanner {
|
- (void)dismissBanner {
|
||||||
|
NSLog(@"🚨 LuckyGiftWinningBannerView dismissBanner 被调用");
|
||||||
[self pop_removeAllAnimations]; // 停止所有动画
|
[self pop_removeAllAnimations]; // 停止所有动画
|
||||||
|
|
||||||
[self popLeaveAnimation:^(bool finished) {
|
[self popLeaveAnimation:^(bool finished) {
|
||||||
|
NSLog(@"🚨 LuckyGiftWinningBannerView 动画完成,调用回调");
|
||||||
if (self.completeDisplay) {
|
if (self.completeDisplay) {
|
||||||
self.completeDisplay();
|
self.completeDisplay();
|
||||||
|
} else {
|
||||||
|
NSLog(@"🚨 警告: completeDisplay 回调为空");
|
||||||
}
|
}
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
}];
|
}];
|
||||||
|
@@ -421,6 +421,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
centerDebugView.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.3];
|
centerDebugView.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.3];
|
||||||
centerDebugView.frame = [self getCenterZone];
|
centerDebugView.frame = [self getCenterZone];
|
||||||
centerDebugView.userInteractionEnabled = NO;
|
centerDebugView.userInteractionEnabled = NO;
|
||||||
|
centerDebugView.tag = 999; // 设置debug视图tag
|
||||||
[self.bannerContainer addSubview:centerDebugView];
|
[self.bannerContainer addSubview:centerDebugView];
|
||||||
|
|
||||||
// 左侧区域 - 半透明红色
|
// 左侧区域 - 半透明红色
|
||||||
@@ -428,6 +429,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
leftDebugView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.3];
|
leftDebugView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.3];
|
||||||
leftDebugView.frame = [self getLeftZone];
|
leftDebugView.frame = [self getLeftZone];
|
||||||
leftDebugView.userInteractionEnabled = NO;
|
leftDebugView.userInteractionEnabled = NO;
|
||||||
|
leftDebugView.tag = 999; // 设置debug视图tag
|
||||||
[self.bannerContainer addSubview:leftDebugView];
|
[self.bannerContainer addSubview:leftDebugView];
|
||||||
|
|
||||||
// 右侧区域 - 半透明绿色
|
// 右侧区域 - 半透明绿色
|
||||||
@@ -435,6 +437,7 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
rightDebugView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.3];
|
rightDebugView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.3];
|
||||||
rightDebugView.frame = [self getRightZone];
|
rightDebugView.frame = [self getRightZone];
|
||||||
rightDebugView.userInteractionEnabled = NO;
|
rightDebugView.userInteractionEnabled = NO;
|
||||||
|
rightDebugView.tag = 999; // 设置debug视图tag
|
||||||
[self.bannerContainer addSubview:rightDebugView];
|
[self.bannerContainer addSubview:rightDebugView];
|
||||||
|
|
||||||
NSLog(@"🎨 区域调试视图已添加");
|
NSLog(@"🎨 区域调试视图已添加");
|
||||||
@@ -451,6 +454,24 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)ensureDebugViewsExist {
|
||||||
|
#ifdef DEBUG
|
||||||
|
// 检查是否已经有debug视图
|
||||||
|
BOOL hasDebugViews = NO;
|
||||||
|
for (UIView *subview in self.bannerContainer.subviews) {
|
||||||
|
if (subview.tag == 999) {
|
||||||
|
hasDebugViews = YES;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!hasDebugViews) {
|
||||||
|
NSLog(@"🎨 重新添加debug视图");
|
||||||
|
[self addZoneDebugViews];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - UIGestureRecognizerDelegate
|
#pragma mark - UIGestureRecognizerDelegate
|
||||||
|
|
||||||
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
|
||||||
@@ -814,7 +835,23 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)handleSwipeOutBanner {
|
- (void)handleSwipeOutBanner {
|
||||||
|
NSLog(@"🚨 发送SwipeOutBanner通知 - 当前状态: isRoomBannerV2Displaying=%@", self.isRoomBannerV2Displaying ? @"YES" : @"NO");
|
||||||
|
|
||||||
|
// 防止重复处理
|
||||||
|
if (!self.isRoomBannerV2Displaying) {
|
||||||
|
NSLog(@"🚨 警告: 尝试关闭banner但状态显示没有正在显示的banner");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 立即设置状态为NO,防止重复处理
|
||||||
|
self.isRoomBannerV2Displaying = NO;
|
||||||
|
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"SwipeOutBanner" object:nil];
|
[[NSNotificationCenter defaultCenter] postNotificationName:@"SwipeOutBanner" object:nil];
|
||||||
|
|
||||||
|
// 延迟处理下一个banner,确保当前banner完全关闭
|
||||||
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[self processNextRoomEffectAttachment];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Banner Interaction Management
|
#pragma mark - Banner Interaction Management
|
||||||
@@ -1183,8 +1220,71 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Method: Banner
|
#pragma mark - Method: Banner
|
||||||
- (void)inserBannerModelToQueue:(id)obj {
|
- (void)inserBannerModelToQueue:(AttachmentModel *)obj {
|
||||||
|
// 参数验证
|
||||||
|
if (!obj || ![obj isKindOfClass:[AttachmentModel class]]) {
|
||||||
|
NSLog(@"⚠️ 警告: inserBannerModelToQueue 接收到无效参数: %@", obj);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
// DEBUG环境:复制banner数据用于测试
|
||||||
|
BOOL enableBannerCopy = YES; // 设置为NO可以禁用复制功能
|
||||||
|
NSInteger copyCount = 10; // 可以调整这个数字来改变复制数量
|
||||||
|
|
||||||
|
if (enableBannerCopy) {
|
||||||
|
NSLog(@"🧪 DEBUG环境:收到banner数据,复制%ld份用于测试", (long)copyCount);
|
||||||
|
NSLog(@"🧪 原始banner类型: %@", NSStringFromClass([obj class]));
|
||||||
|
|
||||||
|
// 添加原始数据
|
||||||
|
[self.roomBannertModelsQueueV2 addObject:obj];
|
||||||
|
|
||||||
|
// 复制指定份数
|
||||||
|
for (int i = 1; i < copyCount; i++) {
|
||||||
|
AttachmentModel *copiedObj = [[AttachmentModel alloc] init];
|
||||||
|
|
||||||
|
// 安全复制data
|
||||||
|
if ([obj.data respondsToSelector:@selector(mutableCopy)]) {
|
||||||
|
copiedObj.data = [obj.data mutableCopy];
|
||||||
|
} else if ([obj.data respondsToSelector:@selector(copy)]) {
|
||||||
|
copiedObj.data = [obj.data copy];
|
||||||
|
} else {
|
||||||
|
copiedObj.data = obj.data; // 直接引用,注意这可能不是深拷贝
|
||||||
|
}
|
||||||
|
|
||||||
|
copiedObj.first = obj.first;
|
||||||
|
copiedObj.second = obj.second;
|
||||||
|
copiedObj.isBroadcast = obj.isBroadcast;
|
||||||
|
copiedObj.seq = obj.seq;
|
||||||
|
|
||||||
|
NSLog(@"🧪 复制第%d份banner数据", i + 1);
|
||||||
|
[self.roomBannertModelsQueueV2 addObject:copiedObj];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"🧪 队列中banner总数: %ld", (long)self.roomBannertModelsQueueV2.count);
|
||||||
|
|
||||||
|
// 显示队列中banner类型的分布
|
||||||
|
NSMutableDictionary *typeCount = [NSMutableDictionary dictionary];
|
||||||
|
for (AttachmentModel *banner in self.roomBannertModelsQueueV2) {
|
||||||
|
NSString *typeKey = [NSString stringWithFormat:@"%d", banner.second];
|
||||||
|
NSNumber *count = typeCount[typeKey];
|
||||||
|
typeCount[typeKey] = @(count.integerValue + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"🧪 队列中banner类型分布:");
|
||||||
|
for (NSString *typeKey in typeCount.allKeys) {
|
||||||
|
NSLog(@" - 类型%@: %@个", typeKey, typeCount[typeKey]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 禁用复制功能,正常添加
|
||||||
|
NSLog(@"🧪 DEBUG环境:复制功能已禁用,正常添加banner");
|
||||||
|
[self.roomBannertModelsQueueV2 addObject:obj];
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
// 生产环境:正常添加
|
||||||
[self.roomBannertModelsQueueV2 addObject:obj];
|
[self.roomBannertModelsQueueV2 addObject:obj];
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!self.isRoomBannerV2Displaying) {
|
if (!self.isRoomBannerV2Displaying) {
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
}
|
}
|
||||||
@@ -1224,13 +1324,18 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)processNextRoomEffectAttachment {
|
- (void)processNextRoomEffectAttachment {
|
||||||
|
NSLog(@"🔄 processNextRoomEffectAttachment 被调用 - 当前状态: isRoomBannerV2Displaying=%@, 队列数量: %ld",
|
||||||
|
self.isRoomBannerV2Displaying ? @"YES" : @"NO", (long)self.roomBannertModelsQueueV2.count);
|
||||||
|
|
||||||
// 检查队列是否有元素
|
// 检查队列是否有元素
|
||||||
if (self.roomBannertModelsQueueV2.count == 0) {
|
if (self.roomBannertModelsQueueV2.count == 0) {
|
||||||
// 如果队列为空,停止处理
|
// 如果队列为空,停止处理
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
|
NSLog(@"🔄 队列为空,停止处理");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (self.isRoomBannerV2Displaying) {
|
if (self.isRoomBannerV2Displaying) {
|
||||||
|
NSLog(@"🔄 已有banner正在显示,跳过处理");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1244,6 +1349,29 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
|
|
||||||
// 设置为正在显示的状态
|
// 设置为正在显示的状态
|
||||||
self.isRoomBannerV2Displaying = YES;
|
self.isRoomBannerV2Displaying = YES;
|
||||||
|
NSLog(@"🔄 设置状态为正在显示: %@", NSStringFromClass([nextAttachment class]));
|
||||||
|
|
||||||
|
// 清理之前的banner,防止多个banner同时显示(保留debug视图)
|
||||||
|
NSMutableArray *viewsToRemove = [NSMutableArray array];
|
||||||
|
for (UIView *subview in self.bannerContainer.subviews) {
|
||||||
|
// 保留debug视图(tag为999的视图)
|
||||||
|
if (subview.tag == 999) {
|
||||||
|
NSLog(@"🔄 保留debug视图: %@", NSStringFromClass([subview class]));
|
||||||
|
} else {
|
||||||
|
// 其他视图都是banner,需要移除
|
||||||
|
[viewsToRemove addObject:subview];
|
||||||
|
NSLog(@"🔄 标记移除banner: %@", NSStringFromClass([subview class]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (UIView *view in viewsToRemove) {
|
||||||
|
[view removeFromSuperview];
|
||||||
|
}
|
||||||
|
|
||||||
|
NSLog(@"🔄 清理了 %ld 个banner视图,保留debug视图", (long)viewsToRemove.count);
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
|
|
||||||
switch (nextAttachment.second) {
|
switch (nextAttachment.second) {
|
||||||
case Custom_Message_Sub_General_Floating_Screen_One_Room:
|
case Custom_Message_Sub_General_Floating_Screen_One_Room:
|
||||||
@@ -1291,6 +1419,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:obj
|
with:obj
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 BravoGiftBannerView complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
} exitCurrentRoom:^{
|
} exitCurrentRoom:^{
|
||||||
@@ -1306,6 +1435,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1323,6 +1455,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:obj
|
with:obj
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 LuckyPackageBannerView complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
} exitCurrentRoom:^{
|
} exitCurrentRoom:^{
|
||||||
@@ -1338,6 +1471,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1357,6 +1493,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:obj
|
with:obj
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 RoomHighValueGiftBannerAnimation complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
}];
|
}];
|
||||||
@@ -1369,6 +1506,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1393,6 +1533,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:attachMent
|
with:attachMent
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 CPGiftBanner complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
}];
|
}];
|
||||||
@@ -1405,6 +1546,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1570,6 +1714,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:nextAttachment
|
with:nextAttachment
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 LuckyGiftWinningBannerView complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
} exitCurrentRoom:^{
|
} exitCurrentRoom:^{
|
||||||
@@ -1585,6 +1730,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1618,6 +1766,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
with:attachment
|
with:attachment
|
||||||
complete:^{
|
complete:^{
|
||||||
@kStrongify(self);
|
@kStrongify(self);
|
||||||
|
NSLog(@"🔄 GameUniversalBannerView complete 回调被调用");
|
||||||
self.isRoomBannerV2Displaying = NO;
|
self.isRoomBannerV2Displaying = NO;
|
||||||
[self processNextRoomEffectAttachment];
|
[self processNextRoomEffectAttachment];
|
||||||
} goToGame:^(NSInteger gameID) {
|
} goToGame:^(NSInteger gameID) {
|
||||||
@@ -1662,6 +1811,9 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 确保debug视图存在
|
||||||
|
[self ensureDebugViewsExist];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -125,11 +125,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)dismissBanner {
|
- (void)dismissBanner {
|
||||||
|
NSLog(@"🚨 RoomHighValueGiftBannerAnimation dismissBanner 被调用");
|
||||||
[self pop_removeAllAnimations]; // 停止所有动画
|
[self pop_removeAllAnimations]; // 停止所有动画
|
||||||
|
|
||||||
[self popLeaveAnimation:^(bool finished) {
|
[self popLeaveAnimation:^(bool finished) {
|
||||||
|
NSLog(@"🚨 RoomHighValueGiftBannerAnimation 动画完成,调用回调");
|
||||||
if (self.animationComplete) {
|
if (self.animationComplete) {
|
||||||
self.animationComplete();
|
self.animationComplete();
|
||||||
|
} else {
|
||||||
|
NSLog(@"🚨 警告: animationComplete 回调为空");
|
||||||
}
|
}
|
||||||
[self removeFromSuperview];
|
[self removeFromSuperview];
|
||||||
}];
|
}];
|
||||||
|
Reference in New Issue
Block a user