优化公共房间管理器的进入逻辑,新增延迟进入公共房间的功能以改善用户体验。同时,移除 RoomAnimationView 中的调试视图相关代码,提升代码整洁性和可维护性。
This commit is contained in:
@@ -102,10 +102,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 重置状态
|
// 重置状态
|
||||||
self.isInitialized = NO;
|
|
||||||
self.isInPublicRoom = NO;
|
self.isInPublicRoom = NO;
|
||||||
self.currentPublicRoomId = nil;
|
self.currentPublicRoomId = nil;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - 状态查询
|
#pragma mark - 状态查询
|
||||||
@@ -263,7 +261,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self tryEnterPublicRoom];
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||||
|
[self tryEnterPublicRoom];
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)exitPublicRoomWithCompletion:(void(^)(NSError * _Nullable error))completion {
|
- (void)exitPublicRoomWithCompletion:(void(^)(NSError * _Nullable error))completion {
|
||||||
|
@@ -322,9 +322,6 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
NSLog(@" - 手势: %@ (delegate: %@)", NSStringFromClass([gesture class]), gesture.delegate ? @"已设置" : @"未设置");
|
NSLog(@" - 手势: %@ (delegate: %@)", NSStringFromClass([gesture class]), gesture.delegate ? @"已设置" : @"未设置");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加调试视图(仅在测试环境)
|
|
||||||
[self addZoneDebugViews];
|
|
||||||
|
|
||||||
// 确保bannerContainer可以接收用户交互
|
// 确保bannerContainer可以接收用户交互
|
||||||
self.bannerContainer.userInteractionEnabled = YES;
|
self.bannerContainer.userInteractionEnabled = YES;
|
||||||
NSLog(@"🔧 bannerContainer用户交互已启用: %@", self.bannerContainer.userInteractionEnabled ? @"是" : @"否");
|
NSLog(@"🔧 bannerContainer用户交互已启用: %@", self.bannerContainer.userInteractionEnabled ? @"是" : @"否");
|
||||||
@@ -403,75 +400,6 @@ XPRoomGraffitiGiftAnimationViewDelegate
|
|||||||
return BannerZoneNone;
|
return BannerZoneNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Visual Debug (Test Environment)
|
|
||||||
|
|
||||||
- (void)addZoneDebugViews {
|
|
||||||
// 仅在测试环境添加
|
|
||||||
#ifdef DEBUG
|
|
||||||
NSLog(@"🎨 开始添加区域调试视图");
|
|
||||||
NSLog(@" - bannerContainer: %@ (frame: %.1f,%.1f,%.1f,%.1f)",
|
|
||||||
self.bannerContainer ? @"存在" : @"nil",
|
|
||||||
self.bannerContainer.frame.origin.x, self.bannerContainer.frame.origin.y,
|
|
||||||
self.bannerContainer.frame.size.width, self.bannerContainer.frame.size.height);
|
|
||||||
|
|
||||||
// 延迟添加,确保布局完成
|
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
||||||
// 中央区域 - 半透明蓝色
|
|
||||||
UIView *centerDebugView = [[UIView alloc] init];
|
|
||||||
centerDebugView.backgroundColor = [[UIColor blueColor] colorWithAlphaComponent:0.3];
|
|
||||||
centerDebugView.frame = [self getCenterZone];
|
|
||||||
centerDebugView.userInteractionEnabled = NO;
|
|
||||||
centerDebugView.tag = 999; // 设置debug视图tag
|
|
||||||
[self.bannerContainer addSubview:centerDebugView];
|
|
||||||
|
|
||||||
// 左侧区域 - 半透明红色
|
|
||||||
UIView *leftDebugView = [[UIView alloc] init];
|
|
||||||
leftDebugView.backgroundColor = [[UIColor redColor] colorWithAlphaComponent:0.3];
|
|
||||||
leftDebugView.frame = [self getLeftZone];
|
|
||||||
leftDebugView.userInteractionEnabled = NO;
|
|
||||||
leftDebugView.tag = 999; // 设置debug视图tag
|
|
||||||
[self.bannerContainer addSubview:leftDebugView];
|
|
||||||
|
|
||||||
// 右侧区域 - 半透明绿色
|
|
||||||
UIView *rightDebugView = [[UIView alloc] init];
|
|
||||||
rightDebugView.backgroundColor = [[UIColor greenColor] colorWithAlphaComponent:0.3];
|
|
||||||
rightDebugView.frame = [self getRightZone];
|
|
||||||
rightDebugView.userInteractionEnabled = NO;
|
|
||||||
rightDebugView.tag = 999; // 设置debug视图tag
|
|
||||||
[self.bannerContainer addSubview:rightDebugView];
|
|
||||||
|
|
||||||
NSLog(@"🎨 区域调试视图已添加");
|
|
||||||
NSLog(@" - 中央区域: 蓝色 (%.1f, %.1f, %.1f, %.1f)",
|
|
||||||
centerDebugView.frame.origin.x, centerDebugView.frame.origin.y,
|
|
||||||
centerDebugView.frame.size.width, centerDebugView.frame.size.height);
|
|
||||||
NSLog(@" - 左侧区域: 红色 (%.1f, %.1f, %.1f, %.1f)",
|
|
||||||
leftDebugView.frame.origin.x, leftDebugView.frame.origin.y,
|
|
||||||
leftDebugView.frame.size.width, leftDebugView.frame.size.height);
|
|
||||||
NSLog(@" - 右侧区域: 绿色 (%.1f, %.1f, %.1f, %.1f)",
|
|
||||||
rightDebugView.frame.origin.x, rightDebugView.frame.origin.y,
|
|
||||||
rightDebugView.frame.size.width, rightDebugView.frame.size.height);
|
|
||||||
});
|
|
||||||
#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 {
|
||||||
@@ -1227,7 +1155,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if 0
|
||||||
// DEBUG环境:复制banner数据用于测试
|
// DEBUG环境:复制banner数据用于测试
|
||||||
BOOL enableBannerCopy = YES; // 设置为NO可以禁用复制功能
|
BOOL enableBannerCopy = YES; // 设置为NO可以禁用复制功能
|
||||||
NSInteger copyCount = 10; // 可以调整这个数字来改变复制数量
|
NSInteger copyCount = 10; // 可以调整这个数字来改变复制数量
|
||||||
@@ -1371,7 +1299,7 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
NSLog(@"🔄 清理了 %ld 个banner视图,保留debug视图", (long)viewsToRemove.count);
|
NSLog(@"🔄 清理了 %ld 个banner视图,保留debug视图", (long)viewsToRemove.count);
|
||||||
|
|
||||||
// 确保debug视图存在
|
// 确保debug视图存在
|
||||||
[self ensureDebugViewsExist];
|
// [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:
|
||||||
@@ -1435,9 +1363,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1471,9 +1396,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1506,9 +1428,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1546,9 +1465,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1730,9 +1646,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1811,9 +1724,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保debug视图存在
|
|
||||||
[self ensureDebugViewsExist];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3165,9 +3075,6 @@ shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherG
|
|||||||
- (XPRoomAnimationHitView *)bannerContainer {
|
- (XPRoomAnimationHitView *)bannerContainer {
|
||||||
if (!_bannerContainer) {
|
if (!_bannerContainer) {
|
||||||
_bannerContainer = [[XPRoomAnimationHitView alloc] init];
|
_bannerContainer = [[XPRoomAnimationHitView alloc] init];
|
||||||
#if DEBUG
|
|
||||||
_bannerContainer.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
return _bannerContainer;
|
return _bannerContainer;
|
||||||
}
|
}
|
||||||
|
@@ -130,12 +130,12 @@ exitCurrentRoom:(void(^)(void))exit {
|
|||||||
if (self) {
|
if (self) {
|
||||||
[self setupUI];
|
[self setupUI];
|
||||||
self.userInteractionEnabled = NO;
|
self.userInteractionEnabled = NO;
|
||||||
// UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
UIButton *b = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
// [self addSubview:b];
|
[self addSubview:b];
|
||||||
// [b mas_remakeConstraints:^(MASConstraintMaker *make) {
|
[b mas_remakeConstraints:^(MASConstraintMaker *make) {
|
||||||
// make.edges.mas_equalTo(self);
|
make.edges.mas_equalTo(self);
|
||||||
// }];
|
}];
|
||||||
// [b addTarget:self action:@selector(handelTap) forControlEvents:UIControlEventTouchUpInside];
|
[b addTarget:self action:@selector(handelTap) forControlEvents:UIControlEventTouchUpInside];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
@@ -340,19 +340,14 @@ UIKIT_EXTERN NSString *kTabShowAnchorCardKey;
|
|||||||
[[IAPManager sharedManager] handleLogin];
|
[[IAPManager sharedManager] handleLogin];
|
||||||
[[IAPManager sharedManager] retryCheckAllReceipt];
|
[[IAPManager sharedManager] retryCheckAllReceipt];
|
||||||
|
|
||||||
// 统一入口:1秒后进入公共房间
|
NSLog(@"TabbarViewController: 统一入口 - 开始进入公共房间");
|
||||||
// @kWeakify(self);
|
[[PublicRoomManager sharedManager] enterPublicRoomWithCompletion:^(NSError * _Nullable error) {
|
||||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
if (error) {
|
||||||
// @kStrongify(self);
|
NSLog(@"TabbarViewController: 进入公共房间失败: %@", error);
|
||||||
NSLog(@"TabbarViewController: 统一入口 - 开始进入公共房间");
|
} else {
|
||||||
[[PublicRoomManager sharedManager] enterPublicRoomWithCompletion:^(NSError * _Nullable error) {
|
NSLog(@"TabbarViewController: 进入公共房间成功");
|
||||||
if (error) {
|
}
|
||||||
NSLog(@"TabbarViewController: 进入公共房间失败: %@", error);
|
}];
|
||||||
} else {
|
|
||||||
NSLog(@"TabbarViewController: 进入公共房间成功");
|
|
||||||
}
|
|
||||||
}];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)getRoomGameInfo{
|
-(void)getRoomGameInfo{
|
||||||
|
Reference in New Issue
Block a user