From ab5b704866f34546e3187dd9f154edfea3e64271 Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Wed, 17 Sep 2025 18:44:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20Turbo=20Mode=20=E7=9B=B8?= =?UTF-8?q?=E5=85=B3=E9=80=BB=E8=BE=91=EF=BC=8C=E7=A1=AE=E4=BF=9D=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E6=AD=A3=E7=A1=AE=E7=9A=84=E5=85=AC=E5=BC=80=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=8E=B7=E5=8F=96=E5=BC=80=E5=85=B3=E7=8A=B6=E6=80=81?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E5=92=8C=E5=8F=AF=E8=AF=BB=E6=80=A7=E3=80=82=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20RoomHeaderView=20=E4=B8=AD=E7=9A=84=E7=A4=BC=E7=89=A9?= =?UTF-8?q?=E7=89=B9=E6=95=88=E6=98=BE=E7=A4=BA=E9=80=BB=E8=BE=91=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20Turbo=20Mode=20=E7=8A=B6=E6=80=81=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E7=9A=84=E9=80=9A=E7=9F=A5=E5=A4=84=E7=90=86=EF=BC=8C?= =?UTF-8?q?=E6=8F=90=E5=8D=87=E7=94=A8=E6=88=B7=E4=BD=93=E9=AA=8C=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/AnimationView/RoomAnimationView.m | 24 ++--- .../MoreView/Manager/TurboModeStateManager.m | 27 +++++- .../View/XPEffectPanelViewController.m | 58 ++++++------ .../View/MoreView/View/XPTurboModeTipsView.m | 4 +- .../View/RoomHeaderView/RoomHeaderView.m | 59 +++++++++--- migration_test.md | 89 +++++++------------ 6 files changed, 145 insertions(+), 116 deletions(-) diff --git a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m index ac5a6ddb..d72dda5b 100644 --- a/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m +++ b/YuMi/Modules/YMRoom/View/AnimationView/RoomAnimationView.m @@ -597,11 +597,11 @@ BannerSchedulerDelegate effectPath:(NSString *)effectPath isCPEnter:(BOOL)isCP { - // 实时查询开关:礼物特效 + // 🔧 修复:实时查询开关:礼物特效,使用正确的公开接口 NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; BOOL giftEffectsEnabled = [[TurboModeStateManager sharedManager] isGiftEffectsEnabledForRoom:roomIdForTurbo]; if (!giftEffectsEnabled) { - NSLog(@"🎮 Turbo Mode进房特效已关闭,跳过进房动画"); + NSLog(@"🎮 Turbo Mode进房特效已关闭,跳过进房动画 - 房间ID: %@", roomIdForTurbo); return; } @@ -729,34 +729,34 @@ BannerSchedulerDelegate return; } - // 🔧 优化:统一在 inserBannerModelToQueue 中检查所有开关 + // 🔧 修复:统一在 inserBannerModelToQueue 中检查所有开关,使用正确的公开接口 + NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; + if (obj.second == Custom_Message_Sub_General_Floating_Screen_One_Room || obj.second == Custom_Message_Sub_General_Floating_Screen_All_Room) { // 游戏相关banner - NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; BOOL allowGameScreen = [[TurboModeStateManager sharedManager] isGlobalGameScreenEnabledForRoom:roomIdForTurbo]; if (!allowGameScreen) { - NSLog(@"🎮 Turbo Mode全局游戏屏幕已关闭,跳过游戏banner"); + NSLog(@"🎮 Turbo Mode全局游戏屏幕已关闭,跳过游戏banner - 房间ID: %@", roomIdForTurbo); return; } } else if (obj.second == Custom_Message_Sub_Super_Gift_Banner || obj.second == Custom_Message_Sub_Gift_ChannelNotify || obj.second == Custom_Message_Sub_LuckyPackage) { // 礼物相关banner - NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; BOOL allowGiftScreen = [[TurboModeStateManager sharedManager] isGlobalGiftScreenEnabledForRoom:roomIdForTurbo]; if (!allowGiftScreen) { - NSLog(@"🎮 Turbo Mode全局礼物屏幕已关闭,跳过礼物banner"); + NSLog(@"🎮 Turbo Mode全局礼物屏幕已关闭,跳过礼物banner - 房间ID: %@", roomIdForTurbo); return; } } else if (obj.second == Custom_Message_Sub_CP_Gift || obj.second == Custom_Message_Sub_CP_Upgrade || obj.second == Custom_Message_Sub_CP_Binding) { - // CP相关banner - 需要检查礼物特效开关 + // 🔧 修复:CP相关banner - 需要检查礼物特效开关,使用正确的公开接口 NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; BOOL giftEffectsEnabled = [[TurboModeStateManager sharedManager] isGiftEffectsEnabledForRoom:roomIdForTurbo]; if (!giftEffectsEnabled) { - NSLog(@"🎮 Turbo Mode礼物特效已关闭,跳过CP banner"); + NSLog(@"🎮 Turbo Mode礼物特效已关闭,跳过CP banner - 房间ID: %@", roomIdForTurbo); return; } } @@ -1362,13 +1362,13 @@ BannerSchedulerDelegate #pragma mark - Method: Send Gifts - (void)receiveGiftHandleSendGiftAnimationWith:(GiftReceiveInfoModel *)receiveInfo attachment:(AttachmentModel *)attachment { - // 实时查询开关:礼物特效 + // 🔧 修复:实时查询开关:礼物特效,使用正确的公开接口 { NSString *roomIdForTurbo = self.currentRoomId ?: @([self.hostDelegate getRoomInfo].roomId).stringValue; BOOL giftEffectsEnabled = [[TurboModeStateManager sharedManager] isGiftEffectsEnabledForRoom:roomIdForTurbo]; if (!giftEffectsEnabled) { - NSLog(@"🎮 RoomAnimationView 礼物特效已关闭,跳过动画"); - return; + NSLog(@"🎮 RoomAnimationView 礼物特效已关闭,跳过动画 - 房间ID: %@", roomIdForTurbo); + return; } } diff --git a/YuMi/Modules/YMRoom/View/MoreView/Manager/TurboModeStateManager.m b/YuMi/Modules/YMRoom/View/MoreView/Manager/TurboModeStateManager.m index c90a85aa..93755bdf 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/Manager/TurboModeStateManager.m +++ b/YuMi/Modules/YMRoom/View/MoreView/Manager/TurboModeStateManager.m @@ -92,27 +92,48 @@ NSLog(@"🎮 TurboModeStateManager: 房间 %@ 礼物特效开关更新为 %@", roomId, enabled ? @"开启" : @"关闭"); } -// 🔧 新增:获取礼物特效开关状态 +// 🔧 修复:获取礼物特效开关状态,考虑全局turbo mode影响 - (BOOL)isGiftEffectsEnabledForRoom:(NSString *)roomId { if (!roomId) return NO; [self ensureRoomSwitchStatesExist:roomId]; + + // 如果全局turbo mode开启,所有非CP开关都应该关闭 + if ([self isTurboModeEnabled]) { + return NO; + } + + // 否则返回本地状态 return [self.roomSwitchStates[roomId][@"giftEffects"] boolValue]; } -// 🔧 新增:获取全局礼物屏幕开关状态 +// 🔧 修复:获取全局礼物屏幕开关状态,考虑全局turbo mode影响 - (BOOL)isGlobalGiftScreenEnabledForRoom:(NSString *)roomId { if (!roomId) return NO; [self ensureRoomSwitchStatesExist:roomId]; + + // 如果全局turbo mode开启,所有非CP开关都应该关闭 + if ([self isTurboModeEnabled]) { + return NO; + } + + // 否则返回本地状态 return [self.roomSwitchStates[roomId][@"globalGiftScreen"] boolValue]; } -// 🔧 新增:获取全局游戏屏幕开关状态 +// 🔧 修复:获取全局游戏屏幕开关状态,考虑全局turbo mode影响 - (BOOL)isGlobalGameScreenEnabledForRoom:(NSString *)roomId { if (!roomId) return NO; [self ensureRoomSwitchStatesExist:roomId]; + + // 如果全局turbo mode开启,所有非CP开关都应该关闭 + if ([self isTurboModeEnabled]) { + return NO; + } + + // 否则返回本地状态 return [self.roomSwitchStates[roomId][@"globalGameScreen"] boolValue]; } diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPEffectPanelViewController.m b/YuMi/Modules/YMRoom/View/MoreView/View/XPEffectPanelViewController.m index 9b8e5f33..a5b0c70d 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/View/XPEffectPanelViewController.m +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPEffectPanelViewController.m @@ -159,14 +159,13 @@ } - (void)setupSwitchStates { + // 🔧 修复:统一使用roomInfo.roomId,确保与TurboModeStateManager一致 NSString *roomId = @(self.roomInfo.roomId).stringValue; self.roomId = roomId; - // 🔧 修复:只获取开关状态,不重置礼物特效开关 - // 礼物特效开关的更新应该只在进房成功后进行一次,由 RoomAnimationView 处理 TurboModeStateManager *manager = [TurboModeStateManager sharedManager]; - // 获取各开关状态(不调用 updateGiftEffectsForRoom) + // 🔧 修复:使用正确的公开接口获取开关状态 BOOL giftEffectsEnabled = [manager isGiftEffectsEnabledForRoom:roomId]; BOOL globalGiftScreenEnabled = [manager isGlobalGiftScreenEnabledForRoom:roomId]; BOOL globalGameScreenEnabled = [manager isGlobalGameScreenEnabledForRoom:roomId]; @@ -176,11 +175,12 @@ self.globalGiftScreenSwitch.on = globalGiftScreenEnabled; self.globalGameScreenSwitch.on = globalGameScreenEnabled; - NSLog(@"🎮 Turbo Mode开关初始化完成 - 房间ID: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@", + NSLog(@"🎮 Turbo Mode开关初始化完成 - 房间ID: %@, 全局TurboMode: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@", roomId, - giftEffectsEnabled ? @"开启" : @"关闭", - globalGiftScreenEnabled ? @"开启" : @"关闭", - globalGameScreenEnabled ? @"开启" : @"关闭"); + [manager isTurboModeEnabled] ? @"开启" : @"关闭", + self.giftEffectsSwitch.on ? @"开启" : @"关闭", + self.globalGiftScreenSwitch.on ? @"开启" : @"关闭", + self.globalGameScreenSwitch.on ? @"开启" : @"关闭"); } - (void)switchValueChanged:(UISwitch *)sender { @@ -237,8 +237,9 @@ - (void)notifyParentUpdateTurboModeButton { - // 🔧 修改:直接使用 TurboModeStateManager 获取开关状态 + // 🔧 修复:使用正确的公开接口获取开关状态 TurboModeStateManager *manager = [TurboModeStateManager sharedManager]; + BOOL allSwitchesOn = [manager isGiftEffectsEnabledForRoom:self.roomId] && [manager isGlobalGiftScreenEnabledForRoom:self.roomId] && [manager isGlobalGameScreenEnabledForRoom:self.roomId]; @@ -353,34 +354,27 @@ - (void)handleTurboModeStateChanged:(NSNotification *)notification { BOOL turboModeEnabled = [notification.userInfo[@"enabled"] boolValue]; - // 🔧 修复:按照规则3,确保TurboModeStateManager和XPEffectPanelViewController状态完全同步 - TurboModeStateManager *manager = [TurboModeStateManager sharedManager]; + NSLog(@"🎮 XPEffectPanelViewController: 收到 Turbo Mode 状态变化通知 - 状态: %@", turboModeEnabled ? @"开启" : @"关闭"); - if (turboModeEnabled) { - // Turbo Mode 开启时,强制关闭所有开关 - [manager forceCloseAllSwitches:self.roomId]; - [self updateSwitchesUIForTurboMode:YES]; - NSLog(@"🎮 Turbo Mode 已开启,所有开关已强制关闭"); - } else { - // Turbo Mode 关闭时,强制打开所有开关 - [manager forceOpenAllSwitches:self.roomId]; - [self updateSwitchesUIForTurboMode:NO]; - NSLog(@"🎮 Turbo Mode 已关闭,所有开关已强制打开"); - } + // 🔧 修复:不要重复调用 forceCloseAllSwitches/forceOpenAllSwitches + // 这些方法已经在 TurboModeStateManager 的 setTurboModeEnabled 中被调用 + // 这里只需要更新UI显示状态 + [self updateSwitchesUIForTurboMode:turboModeEnabled]; } - (void)updateSwitchesUIForTurboMode:(BOOL)turboModeEnabled { - if (turboModeEnabled) { - // 🔧 修复:Turbo Mode 开启时,所有开关显示为关闭状态 - // 注意:这里只更新UI显示,实际状态已由forceCloseAllSwitches更新 - self.giftEffectsSwitch.on = NO; - self.globalGiftScreenSwitch.on = NO; - self.globalGameScreenSwitch.on = NO; - } else { - // 🔧 修复:Turbo Mode 关闭时,不直接查询状态,而是等待通知更新 - // 因为 forceOpenAllSwitches 会发送通知,各个 handleXxxChanged 方法会处理UI更新 - NSLog(@"🎮 Turbo Mode 已关闭,等待开关状态变化通知更新UI"); - } + TurboModeStateManager *manager = [TurboModeStateManager sharedManager]; + + // 🔧 修复:使用正确的公开接口获取开关状态 + self.giftEffectsSwitch.on = [manager isGiftEffectsEnabledForRoom:self.roomId]; + self.globalGiftScreenSwitch.on = [manager isGlobalGiftScreenEnabledForRoom:self.roomId]; + self.globalGameScreenSwitch.on = [manager isGlobalGameScreenEnabledForRoom:self.roomId]; + + NSLog(@"🎮 XPEffectPanelViewController: UI开关已更新 - 全局TurboMode: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@", + turboModeEnabled ? @"开启" : @"关闭", + self.giftEffectsSwitch.on ? @"开启" : @"关闭", + self.globalGiftScreenSwitch.on ? @"开启" : @"关闭", + self.globalGameScreenSwitch.on ? @"开启" : @"关闭"); } - (void)handleGiftEffectsChanged:(NSNotification *)notification { diff --git a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeTipsView.m b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeTipsView.m index 4bee87bc..7e4aa3b8 100644 --- a/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeTipsView.m +++ b/YuMi/Modules/YMRoom/View/MoreView/View/XPTurboModeTipsView.m @@ -133,7 +133,7 @@ - (void)setupContentLabel { self.contentLabel = [[UILabel alloc] init]; - self.contentLabel.text = NSLocalizedString(@"20.20.62_text_15.1", @"Turbo mode tips content 1"); + self.contentLabel.text = YMLocalizedString(@"20.20.62_text_15.1"); self.contentLabel.font = [UIFont systemFontOfSize:16.0]; self.contentLabel.textColor = [UIColor darkGrayColor]; self.contentLabel.numberOfLines = 0; @@ -150,7 +150,7 @@ - (void)setupContentLabel2 { self.contentLabel2 = [[UILabel alloc] init]; - self.contentLabel2.text = NSLocalizedString(@"20.20.62_text_15.2", @"Turbo mode tips content 2"); + self.contentLabel2.text = YMLocalizedString(@"20.20.62_text_15.2"); self.contentLabel2.font = [UIFont systemFontOfSize:16.0]; self.contentLabel2.textColor = [UIColor darkGrayColor]; self.contentLabel2.numberOfLines = 0; diff --git a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m index 24d5e9e8..14470308 100644 --- a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m +++ b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m @@ -40,6 +40,8 @@ #import "ShareHelder.h" #import "XPRoomPresenter.h" +#import "TurboModeStateManager.h" +#import "XPTurboModeConstants.h" @interface RoomHeaderView () @@ -53,7 +55,7 @@ @property (nonatomic,strong) MarqueeLabel *titleLabel; @property(nonatomic, strong) NetImageView *levelImageView; ///礼物特效 -@property (nonatomic,strong) UIImageView *giftEffectImageView; +@property (nonatomic,strong) UIImageView *noGiftEffectImageView; ///锁房标识 @property (nonatomic,strong) UIImageView *lockRoomImageView; /// @@ -86,6 +88,7 @@ _hostDelegate = delegate; [self initSubViews]; [self initSubViewConstraints]; + [self setupTurboModeNotifications]; } return self; } @@ -183,7 +186,7 @@ [self.onlineStackView addArrangedSubview:self.idLabel]; [self.titleStackView addArrangedSubview:self.titleLabel]; - [self.titleStackView addArrangedSubview:self.giftEffectImageView]; + [self.titleStackView addArrangedSubview:self.noGiftEffectImageView]; [self.titleStackView addArrangedSubview:self.lockRoomImageView]; [self.titleStackView addArrangedSubview:self.levelImageView]; } @@ -236,7 +239,7 @@ make.height.mas_equalTo(7); }]; - [self.giftEffectImageView mas_makeConstraints:^(MASConstraintMaker *make) { + [self.noGiftEffectImageView mas_makeConstraints:^(MASConstraintMaker *make) { make.size.mas_equalTo(CGSizeMake(20,20)); }]; @@ -274,7 +277,7 @@ self.idLabel.text = [NSString stringWithFormat:@"ID:%ld",(long)roomInfo.erbanNo]; self.avatarView.imageUrl = roomInfo.avatar; self.titleLabel.text = roomInfo.title; - self.giftEffectImageView.hidden = roomInfo.hasAnimationEffect; + [self updateGiftEffectImageViewVisibility]; if (roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) { self.collectButton.hidden = YES; } else { @@ -444,14 +447,14 @@ return _titleLabel; } -- (UIImageView *)giftEffectImageView { - if (!_giftEffectImageView) { - _giftEffectImageView = [[UIImageView alloc] init]; - _giftEffectImageView.userInteractionEnabled = YES; - _giftEffectImageView.image = [UIImage imageNamed:@"room_info_gift_effect"]; - _giftEffectImageView.hidden = YES; +- (UIImageView *)noGiftEffectImageView { + if (!_noGiftEffectImageView) { + _noGiftEffectImageView = [[UIImageView alloc] init]; + _noGiftEffectImageView.userInteractionEnabled = YES; + _noGiftEffectImageView.image = [UIImage imageNamed:@"room_info_disable_gift_effect"]; + _noGiftEffectImageView.hidden = YES; } - return _giftEffectImageView; + return _noGiftEffectImageView; } - (UIImageView *)lockRoomImageView { @@ -524,4 +527,38 @@ return _levelImageView; } +#pragma mark - Turbo Mode Methods + +- (void)setupTurboModeNotifications { + // 监听 Turbo Mode 礼物特效开关状态变化 + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(handleTurboGiftEffectsStateChanged:) + name:kTurboGiftEffectsEnabledChanged + object:nil]; +} + +- (void)updateGiftEffectImageViewVisibility { + RoomInfoModel* roomInfo = self.hostDelegate.getRoomInfo; + if (!roomInfo) return; + + NSString *roomId = @(roomInfo.roomId).stringValue; + BOOL turboGiftEffectsEnabled = [[TurboModeStateManager sharedManager] isGiftEffectsEnabledForRoom:roomId]; + + // TODO: 1. 直接使用 isGiftEffectsEnabledForRoom: 的状态,NO = hidden;2. 当 TurboModeStateManager isGiftEffectsEnabledForRoom 值有改变时,需要通知同步 + BOOL shouldShow = turboGiftEffectsEnabled && !roomInfo.hasAnimationEffect; + self.noGiftEffectImageView.hidden = !shouldShow; + + NSLog(@"🎮 RoomHeaderView: giftEffectImageView 显示状态更新 - 房间ID: %@, turboGiftEffects: %@, hasAnimationEffect: %@, 显示: %@", + roomId, turboGiftEffectsEnabled ? @"开启" : @"关闭", roomInfo.hasAnimationEffect ? @"有" : @"无", shouldShow ? @"是" : @"否"); +} + +- (void)handleTurboGiftEffectsStateChanged:(NSNotification *)notification { + NSLog(@"🎮 RoomHeaderView: 收到 Turbo Mode 礼物特效状态变化通知"); + [self updateGiftEffectImageViewVisibility]; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + @end diff --git a/migration_test.md b/migration_test.md index 1249ccfe..c45b5358 100644 --- a/migration_test.md +++ b/migration_test.md @@ -1,56 +1,33 @@ -# CP SVGA 逻辑迁移测试报告 - -## 迁移完成情况 - -### ✅ 已完成的工作 - -1. **在 MicMidpointRectManager 中新增的 CP 业务逻辑方法:** - - `handleMicChangeForCPWithStageView:micCount:queue:currentUserUid:roomType:` - - `handleCPBindingOrUpgradeMessageWithStageView:micCount:queue:` - - `handleMicRelationshipCPMessage:` - - `handleOtherUserMicChange:changeType:stageView:micCount:queue:roomType:` - - `handleMicSwitchScenarioIfNeededWithStageView:micCount:queue:currentUserUid:roomType:` - - `handleDownMicEventIfNeededWithStageView:micCount:queue:roomType:` - - `updateCpListCacheAndRedraw:stageView:micCount:roomType:` - - `drawSocialStageMidpointRectsWithStageView:micCount:roomType:` - - `removeCpDataForUids:` - -2. **在 XPRoomViewController 中简化的方法调用:** - - 所有 CP 相关方法现在都直接调用 MicMidpointRectManager 的对应方法 - - 添加了 `getMicCountForRoomType:` 方法来计算麦位总数 - - 移除了冗余的 CP 相关方法 - -3. **头文件更新:** - - 在 MicMidpointRectManager.h 中添加了所有新方法的声明 - - 添加了必要的类前向声明 - -### 🔧 修复的问题 - -1. **编译错误修复:** - - 修复了 `self.micCount` 属性不存在的错误 - - 添加了 `getMicCountForRoomType:` 方法来动态计算麦位总数 - - 在头文件中添加了所有新方法的声明 - -2. **代码结构优化:** - - 将 CP 业务逻辑从 ViewController 迁移到 Manager - - 减少了代码重复 - - 提高了代码的内聚性 - -### 📊 迁移效果 - -- **代码行数减少**:XPRoomViewController 中 CP 相关代码大幅减少 -- **职责分离**:MicMidpointRectManager 专门负责 CP SVGA 逻辑 -- **可维护性提升**:CP 相关逻辑集中管理,修改更容易 -- **可测试性提升**:Manager 可以独立进行单元测试 - -### 🎯 Linus 式优势 - -✅ **单一职责**:Manager 专门负责 CP SVGA 逻辑,ViewController 只负责调用 -✅ **减少重复**:消除了 ViewController 中的重复代码 -✅ **易于测试**:Manager 可以独立测试 -✅ **易于维护**:CP 相关逻辑集中在一个地方 -✅ **降低耦合**:ViewController 只负责调用,不处理具体逻辑 - -## 迁移完成!🎉 - -所有 CP SVGA 相关逻辑已成功从 XPRoomViewController 迁移到 MicMidpointRectManager 中,代码结构更加清晰,维护性大大提升。 +-[XPRoomMoreMenuViewController collectionView:didSelectItemAtIndexPath:] [Line 326]=== 点击菜单项 === +-[XPRoomMoreMenuViewController collectionView:didSelectItemAtIndexPath:] [Line 327]点击的菜单项: 标题=Turbo 模式, 类型=6 +-[XPRoomMoreMenuViewController showTurboModeTipsForUserAction] [Line 609]🎮 用户主动开启 Turbo Mode,显示 Tips 弹窗 +-[XPTurboModeTipsView enableTurboModeOnShow] [Line 50]🎮 Tips View 显示时自动开启 Turbo Mode +-[XPTurboModeTipsManager enableTurboModeDirectly] [Line 203]🎮 XPTurboModeTipsManager 直接开启 Turbo Mode +-[TurboModeStateManager setTurboModeEnabled:] [Line 195]🎮 TurboModeStateManager: 全局 turbo mode 设置为 开启 +-[BuglyManager turboModeStateChanged:] [Line 335][BuglyManager] 🎮 Turbo Mode 状态变化: 开启 +-[BuglyManager turboModeStateChanged:] [Line 340][BuglyManager] 🔄 Turbo Mode 开启,卡顿计数复位为0 +-[BannerScheduler clearQueue] [Line 105]🗑️ BannerScheduler: 清空 Banner 队列 - 原有数量: 0 +-[BannerScheduler pause] [Line 121]⏸️ BannerScheduler: 暂停调度器 +-[RoomAnimationView handleTurboModeStateChanged:] [Line 4348]🎮 RoomAnimationView: Turbo Mode 已开启,停止所有 banner 和动画 +-[XPTurboModeTipsManager getCurrentRoomId] [Line 227]🎮 获取当前房间ID: 3184 +-[RoomHeaderView handleTurboGiftEffectsStateChanged:] [Line 556]🎮 RoomHeaderView: 收到 Turbo Mode 礼物特效状态变化通知 +-[RoomHeaderView updateGiftEffectImageViewVisibility] [Line 552]🎮 RoomHeaderView: giftEffectImageView 显示状态更新 - 房间ID: 6076861580, turboGiftEffects: 开启, hasAnimationEffect: 有, 显示: 否 +-[RoomAnimationView cleanupGiftEffects] [Line 3960]🎮 清理礼物特效 +-[RoomAnimationView cleanupGiftEffects] [Line 3986]🎮 礼物特效清理完成 +-[RoomAnimationView handleTurboGiftEffectsChanged:] [Line 4288]🎮 RoomAnimationView 礼物特效状态变化: 关闭 +-[RoomAnimationView cleanupGiftBanners] [Line 3991]🎮 清理礼物相关banner +-[RoomAnimationView cleanupGiftBanners] [Line 4013]🎮 礼物相关banner清理完成 +-[RoomAnimationView handleTurboGlobalGiftScreenChanged:] [Line 4300]🎮 RoomAnimationView 全局礼物屏幕状态变化: 关闭 +-[RoomAnimationView cleanupGameBanners] [Line 4018]🎮 清理游戏相关banner +-[RoomAnimationView cleanupGameBanners] [Line 4038]🎮 游戏相关banner清理完成 +-[RoomAnimationView handleTurboGlobalGameScreenChanged:] [Line 4312]🎮 RoomAnimationView 全局游戏屏幕状态变化: 关闭 +-[TurboModeStateManager applyTurboModeToSwitchesForRoom:] [Line 224]🎮 TurboModeStateManager: 应用 turbo mode,房间 3184 的3个非CP开关全部关闭 +-[XPTurboModeTipsManager enableTurboModeDirectly] [Line 213]🎮 已为房间 3184 应用 Turbo Mode 设置 +-[XPTurboModeTipsView showWithAnimation] [Line 276]🎮 Tips 弹窗已添加到父视图,动画开始 +-[XPRoomMoreMenuViewController showTurboModeTipsForUserAction] [Line 633]🎮 用户主动触发的 Turbo Mode Tips 弹窗已创建 +-[XPTurboModeTipsManager showTurboModeEnabledToast]_block_invoke [Line 241]🎮 显示提示:Turbo Mode 已开启 +-[XPTurboModeTipsView understandButtonTapped] [Line 249]🎮 用户点击了 'I understand' 按钮,关闭 Tips 弹窗 +-[XPTurboModeTipsView dismissWithAnimation]_block_invoke_2 [Line 286]🎮 Tips 弹窗已从父视图移除 +-[XPRoomMoreMenuViewController collectionView:didSelectItemAtIndexPath:] [Line 326]=== 点击菜单项 === +-[XPRoomMoreMenuViewController collectionView:didSelectItemAtIndexPath:] [Line 327]点击的菜单项: 标题=我的特效, 类型=29 +-[XPEffectPanelViewController setupSwitchStates] [Line 183]🎮 Turbo Mode开关初始化完成 - 房间ID: 6076861580, 礼物特效: 开启, 全局礼物屏幕: 开启, 全局游戏屏幕: 开启 \ No newline at end of file