新增 Turbo Mode 功能,包含相关的 Action 类、常量和视图控制器,优化房间更多菜单的功能扩展性。同时,更新通知逻辑以支持 Turbo Mode 开关状态的管理,提升代码可维护性和用户体验。

This commit is contained in:
edwinQQQ
2025-09-03 16:32:15 +08:00
parent cff4ddeeba
commit 8dbb02228f
28 changed files with 1061 additions and 385 deletions

View File

@@ -506,7 +506,9 @@
4C3851992DD5F4D50089CFCC /* EventConfigModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C3851982DD5F4D50089CFCC /* EventConfigModel.m */; };
4C38C2AD2D84064400CFA4A8 /* LoginInputItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C38C2AC2D84064300CFA4A8 /* LoginInputItemView.m */; };
4C38C2B02D84070600CFA4A8 /* AccountBindingViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C38C2AF2D84070600CFA4A8 /* AccountBindingViewController.m */; };
4C4283F62E66C769006779B0 /* XPTurboModeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */; };
4C44BD5D2D151B5C00F321FA /* RoomSideMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */; };
4C45C1A52E6825F300E73A44 /* XPTurboModeConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */; };
4C4707A52D53430300C8CD24 /* NSData+GZIP.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C4707A42D53430300C8CD24 /* NSData+GZIP.m */; };
4C51B09C2DA3B4C600D8DFB5 /* LudoGameViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09B2DA3B4C600D8DFB5 /* LudoGameViewController.m */; };
4C51B09F2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C51B09E2DA50FDA00D8DFB5 /* CPRelationshipChangeView.m */; };
@@ -571,6 +573,7 @@
4CC312272D79A10100F57A07 /* ShareProvider.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC312262D79A10100F57A07 /* ShareProvider.m */; };
4CC6195A2CEC7770008C1EE8 /* MyDressingDataPresent.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */; };
4CC6195D2CEC996E008C1EE8 /* MyDressingDataModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */; };
4CC77BBD2E66A33C0067DA96 /* XPRoomEffectAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */; };
4CCA0C6E2DDED89F00E30513 /* Custom9MicLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */; };
4CCA0C6F2DDED89F00E30513 /* UserRoomMicPositionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6D2DDED89F00E30513 /* UserRoomMicPositionView.m */; };
4CCA0C702DDED89F00E30513 /* UserRoomMicPositionCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CCA0C6B2DDED89F00E30513 /* UserRoomMicPositionCell.m */; };
@@ -585,7 +588,7 @@
4CD47BB52E61514900BCDA46 /* StageViewManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BB42E61514900BCDA46 /* StageViewManager.m */; };
4CD47BBE2E619F1700BCDA46 /* XPRoomMoreMenuAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BBB2E619F1700BCDA46 /* XPRoomMoreMenuAction.m */; };
4CD47BBF2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BBD2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m */; };
4CD47BC42E61A4E000BCDA46 /* XPGiftEffectAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */; };
4CD47BC42E61A4E000BCDA46 /* XPTurboModeAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */; };
4CD47BC62E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC52E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m */; };
4CD47BC92E61A78D00BCDA46 /* XPRoomSettingAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */; };
4CD47BCC2E61ADE400BCDA46 /* XPSocialAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD47BCB2E61ADE400BCDA46 /* XPSocialAction.m */; };
@@ -2675,8 +2678,12 @@
4C38C2AC2D84064300CFA4A8 /* LoginInputItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginInputItemView.m; sourceTree = "<group>"; };
4C38C2AE2D84070600CFA4A8 /* AccountBindingViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AccountBindingViewController.h; sourceTree = "<group>"; };
4C38C2AF2D84070600CFA4A8 /* AccountBindingViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AccountBindingViewController.m; sourceTree = "<group>"; };
4C4283F42E66C769006779B0 /* XPTurboModeViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeViewController.h; sourceTree = "<group>"; };
4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeViewController.m; sourceTree = "<group>"; };
4C44BD5B2D151B5C00F321FA /* RoomSideMenu.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RoomSideMenu.h; sourceTree = "<group>"; };
4C44BD5C2D151B5C00F321FA /* RoomSideMenu.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RoomSideMenu.m; sourceTree = "<group>"; };
4C45C1A32E6825F300E73A44 /* XPTurboModeConstants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeConstants.h; sourceTree = "<group>"; };
4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeConstants.m; sourceTree = "<group>"; };
4C4707A32D53430300C8CD24 /* NSData+GZIP.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSData+GZIP.h"; sourceTree = "<group>"; };
4C4707A42D53430300C8CD24 /* NSData+GZIP.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSData+GZIP.m"; sourceTree = "<group>"; };
4C4DE6442E2513DA00122763 /* pt-BR */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "pt-BR"; path = "pt-BR.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
@@ -2803,6 +2810,8 @@
4CC619592CEC7770008C1EE8 /* MyDressingDataPresent.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataPresent.m; sourceTree = "<group>"; };
4CC6195B2CEC996E008C1EE8 /* MyDressingDataModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MyDressingDataModel.h; sourceTree = "<group>"; };
4CC6195C2CEC996E008C1EE8 /* MyDressingDataModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MyDressingDataModel.m; sourceTree = "<group>"; };
4CC77BBB2E66A33C0067DA96 /* XPRoomEffectAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomEffectAction.h; sourceTree = "<group>"; };
4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomEffectAction.m; sourceTree = "<group>"; };
4CCA0C662DDED89F00E30513 /* Custom9MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom9MicLayout.h; sourceTree = "<group>"; };
4CCA0C672DDED89F00E30513 /* Custom9MicLayout.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Custom9MicLayout.m; sourceTree = "<group>"; };
4CCA0C682DDED89F00E30513 /* Custom19MicLayout.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Custom19MicLayout.h; sourceTree = "<group>"; };
@@ -2825,13 +2834,13 @@
4CD15D942D7FE9E400D9279F /* LoginTypesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LoginTypesViewController.m; sourceTree = "<group>"; };
4CD47BB32E61514900BCDA46 /* StageViewManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = StageViewManager.h; sourceTree = "<group>"; };
4CD47BB42E61514900BCDA46 /* StageViewManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = StageViewManager.m; sourceTree = "<group>"; };
4CD47BB62E619F0B00BCDA46 /* XPGiftEffectAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPGiftEffectAction.h; sourceTree = "<group>"; };
4CD47BB62E619F0B00BCDA46 /* XPTurboModeAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPTurboModeAction.h; sourceTree = "<group>"; };
4CD47BB82E619F0B00BCDA46 /* XPRoomMoreMenuActionFactory.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuActionFactory.h; sourceTree = "<group>"; };
4CD47BBA2E619F1700BCDA46 /* XPRoomMoreMenuAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuAction.h; sourceTree = "<group>"; };
4CD47BBB2E619F1700BCDA46 /* XPRoomMoreMenuAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuAction.m; sourceTree = "<group>"; };
4CD47BBC2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomMoreMenuActionContext.h; sourceTree = "<group>"; };
4CD47BBD2E619F1700BCDA46 /* XPRoomMoreMenuActionContext.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuActionContext.m; sourceTree = "<group>"; };
4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftEffectAction.m; sourceTree = "<group>"; };
4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPTurboModeAction.m; sourceTree = "<group>"; };
4CD47BC52E61A4FA00BCDA46 /* XPRoomMoreMenuActionFactory.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMoreMenuActionFactory.m; sourceTree = "<group>"; };
4CD47BC72E61A78D00BCDA46 /* XPRoomSettingAction.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomSettingAction.h; sourceTree = "<group>"; };
4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomSettingAction.m; sourceTree = "<group>"; };
@@ -6913,8 +6922,8 @@
4C0B4A392E6579C700D67F73 /* XPPKAction.m */,
4CD47BCA2E61ADE400BCDA46 /* XPSocialAction.h */,
4CD47BCB2E61ADE400BCDA46 /* XPSocialAction.m */,
4CD47BB62E619F0B00BCDA46 /* XPGiftEffectAction.h */,
4CD47BC32E61A4E000BCDA46 /* XPGiftEffectAction.m */,
4CD47BB62E619F0B00BCDA46 /* XPTurboModeAction.h */,
4CD47BC32E61A4E000BCDA46 /* XPTurboModeAction.m */,
4CD47BC72E61A78D00BCDA46 /* XPRoomSettingAction.h */,
4CD47BC82E61A78D00BCDA46 /* XPRoomSettingAction.m */,
4C0B4A3C2E659A2C00D67F73 /* XPRoomTypeSettingAction.h */,
@@ -6931,6 +6940,8 @@
4C0B4A4C2E65A63400D67F73 /* XPRoomRoomPhotoAction.m */,
4C0B4A4E2E65A68800D67F73 /* XPRoomAppManagerAction.h */,
4C0B4A4F2E65A68800D67F73 /* XPRoomAppManagerAction.m */,
4CC77BBB2E66A33C0067DA96 /* XPRoomEffectAction.h */,
4CC77BBC2E66A33C0067DA96 /* XPRoomEffectAction.m */,
);
path = Action;
sourceTree = "<group>";
@@ -11168,6 +11179,8 @@
E8DEC9962764A51F0078CB70 /* MoreView */ = {
isa = PBXGroup;
children = (
4C45C1A32E6825F300E73A44 /* XPTurboModeConstants.h */,
4C45C1A42E6825F300E73A44 /* XPTurboModeConstants.m */,
4CD47BB72E619F0B00BCDA46 /* Action */,
4CD47BB92E619F0B00BCDA46 /* Factory */,
E8DEC99B2764A5620078CB70 /* Model */,
@@ -11199,6 +11212,8 @@
E8DEC9992764A54C0078CB70 /* View */ = {
isa = PBXGroup;
children = (
4C4283F42E66C769006779B0 /* XPTurboModeViewController.h */,
4C4283F52E66C769006779B0 /* XPTurboModeViewController.m */,
E8DEC9A92764A6AF0078CB70 /* Cell */,
E8DEC99C2764A5B60078CB70 /* XPRoomMoreMenuViewController.h */,
E8DEC99D2764A5B60078CB70 /* XPRoomMoreMenuViewController.m */,
@@ -12315,7 +12330,7 @@
E8A3538528FD67320014A784 /* GiftLuckyBroadcastModel.m in Sources */,
9B4C5B86292F81FA00CEA41B /* XPSessionListFansPartyModel.m in Sources */,
547080DB2CD0EEB4009879E5 /* CustomRoomBGContentViewController.m in Sources */,
4CD47BC42E61A4E000BCDA46 /* XPGiftEffectAction.m in Sources */,
4CD47BC42E61A4E000BCDA46 /* XPTurboModeAction.m in Sources */,
237B94BD2A984DA7007853E3 /* XPNobleTrumpetModel.m in Sources */,
E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */,
236B2E4C2AA07D06003967A8 /* XPLittleGameRoomOpenView.m in Sources */,
@@ -12359,6 +12374,7 @@
E84BF7D1277BFCDD00EF8877 /* RoomTagModel.m in Sources */,
E8AC723526F49939007D6E91 /* XPMineNotificaPresenter.m in Sources */,
1427218E29A75F6F00C7C423 /* HTTPMessage.m in Sources */,
4C45C1A52E6825F300E73A44 /* XPTurboModeConstants.m in Sources */,
239D0FE72C049D61002977CE /* MSRoomGameMsgView.m in Sources */,
238B37BE2AC55A2C00BFC9D5 /* XPTreasureFairyBottomView.m in Sources */,
9B42869828C1E06B009034D2 /* XPRedPacketModel.m in Sources */,
@@ -12757,6 +12773,7 @@
23E9EAAD2A84C9B800B792F2 /* XPMineUserInfoTagItemView.m in Sources */,
18A61BE8274F9CF000A09A54 /* SessionListViewController.m in Sources */,
E8C1CD6A27D8937800376F83 /* XPRoomFaceCollectionViewCell.m in Sources */,
4CC77BBD2E66A33C0067DA96 /* XPRoomEffectAction.m in Sources */,
9B2EA7C02804037700ED17BF /* AnchorPKStageView.m in Sources */,
4C1392992D6DB4CD00A6DFB5 /* MoliMoneyLabel.m in Sources */,
23CEFC622AFB8FC100576D89 /* BSLogNetDetailViewController.m in Sources */,
@@ -13402,6 +13419,7 @@
9BAA5FF0277A23F4007453F3 /* XPPermissionsViewController.m in Sources */,
E85E7BA02A4EC99300B6D00A /* XPMineGiveDiamondDetailsModel.m in Sources */,
4CE746C32D9290430094E496 /* RoomBoomManager.m in Sources */,
4C4283F62E66C769006779B0 /* XPTurboModeViewController.m in Sources */,
4CBBB44C2DA66334001B1C6D /* MessageCPNotifyModel.m in Sources */,
E81A654C28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m in Sources */,
E85E7B9F2A4EC99300B6D00A /* XPMineGiveDiamondPresenter.m in Sources */,

View File

@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "房间背景@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -77,6 +77,7 @@
#import "XPRoomRankEntranceView.h"
#import "XPRoomAnchorRankEnterView.h"
#import "MSRoomOnLineView.h"
#import "XPTurboModeConstants.h"
#import "BannerScheduler.h"
#import "GameBannerGestureManager.h"
@@ -162,7 +163,7 @@ BannerSchedulerDelegate
/// ---
@property(nonatomic, assign) BOOL isPlayOfB;
@property(nonatomic, strong) NSMutableArray<PIBaseAnimationViewModel *> *animationListB; //
@property(nonatomic, assign) CGFloat broadCastHieght;
@property (nonatomic, assign) CGFloat broadCastHieght;
@property (nonatomic, strong) NetImageView *imageLoader;
@property (nonatomic, strong) SVGAImageView *datingEffectView;
@property (nonatomic, strong) NSMutableArray<AttachmentModel *> *sailingQueue;
@@ -183,6 +184,12 @@ BannerSchedulerDelegate
@property (nonatomic, strong) UISwipeGestureRecognizer *swipeWhenPlayGame;
// 🔧 Turbo Mode
@property (nonatomic, assign) BOOL turboGiftEffectsEnabled; //
@property (nonatomic, assign) BOOL turboGlobalGiftScreenEnabled; //
@property (nonatomic, assign) BOOL turboGlobalGameScreenEnabled; //
@property (nonatomic, strong) NSString *currentRoomId; // ID
@end
@implementation RoomAnimationView
@@ -381,6 +388,12 @@ BannerSchedulerDelegate
selector:@selector(handleRoomTypeChanged:)
name:@"RoomTypeChanged"
object:nil];
// 🔧 Turbo Mode
[self setupTurboModeSwitches];
// 🔧 Turbo Mode
[self setupTurboModeNotifications];
}
- (void)setupUI {
@@ -441,6 +454,48 @@ BannerSchedulerDelegate
_animationListB = @[].mutableCopy;
}
// 🔧 Turbo Mode
- (void)setupTurboModeSwitches {
NSString *roomId = @(self.hostDelegate.getRoomInfo.roomId).stringValue;
self.currentRoomId = roomId;
//
self.turboGiftEffectsEnabled = self.hostDelegate.getRoomInfo.hasAnimationEffect;
// NSUserDefaults NO
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
id giftScreenObj = [defaults objectForKey:kTurboGlobalGiftScreenEnabledKey(roomId)];
self.turboGlobalGiftScreenEnabled = (giftScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] : YES;
id gameScreenObj = [defaults objectForKey:kTurboGlobalGameScreenEnabledKey(roomId)];
self.turboGlobalGameScreenEnabled = (gameScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] : YES;
NSLog(@"🎮 RoomAnimationView Turbo Mode开关初始化 - 房间ID: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@",
roomId,
self.turboGiftEffectsEnabled ? @"开启" : @"关闭",
self.turboGlobalGiftScreenEnabled ? @"开启" : @"关闭",
self.turboGlobalGameScreenEnabled ? @"开启" : @"关闭");
}
// 🔧 Turbo Mode
- (void)setupTurboModeNotifications {
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleTurboGiftEffectsChanged:)
name:kTurboGiftEffectsEnabledChanged
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleTurboGlobalGiftScreenChanged:)
name:kTurboGlobalGiftScreenEnabledChanged
object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleTurboGlobalGameScreenChanged:)
name:kTurboGlobalGameScreenEnabledChanged
object:nil];
NSLog(@"🎮 Turbo Mode通知监听设置完成");
}
#pragma mark - Method: Enter Roooooom
- (void)enterRoom:(NIMMessage *)message content:(NIMChatroomNotificationContent *)content {
NIMMessageChatroomExtension *messageExt = (NIMMessageChatroomExtension *)message.messageExt;
@@ -533,6 +588,12 @@ BannerSchedulerDelegate
effectPath:(NSString *)effectPath
isCPEnter:(BOOL)isCP {
// 🔧 Turbo Mode
if (!self.turboGiftEffectsEnabled) {
NSLog(@"🎮 Turbo Mode进房特效已关闭跳过进房动画");
return;
}
NSDictionary *attributes = @{
NSFontAttributeName:kFontRegular(26),
NSForegroundColorAttributeName:[UIColor whiteColor]
@@ -657,6 +718,24 @@ BannerSchedulerDelegate
return;
}
// 🔧 Turbo Mode Banner
if (obj.second == Custom_Message_Sub_General_Floating_Screen_One_Room ||
obj.second == Custom_Message_Sub_General_Floating_Screen_All_Room) {
// banner
if (!self.turboGlobalGameScreenEnabled) {
NSLog(@"🎮 Turbo Mode全局游戏屏幕已关闭跳过游戏banner");
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
if (!self.turboGlobalGiftScreenEnabled) {
NSLog(@"🎮 Turbo Mode全局礼物屏幕已关闭跳过礼物banner");
return;
}
}
#if 0
// DEBUGbanner
BOOL enableBannerCopy = obj.second == Custom_Message_Sub_Super_Gift_Banner;// YES; // NO
@@ -881,6 +960,12 @@ BannerSchedulerDelegate
}
- (void)receiveCPEvent:(AttachmentModel *)attachment {
// 🔧 Turbo Mode
if (!self.turboGiftEffectsEnabled) {
NSLog(@"🎮 RoomAnimationView 礼物特效已关闭跳过CP动画");
return;
}
[self inserBannerModelToQueue:attachment];
}
@@ -1254,6 +1339,12 @@ BannerSchedulerDelegate
#pragma mark - Method: Send Gifts
- (void)receiveGiftHandleSendGiftAnimationWith:(GiftReceiveInfoModel *)receiveInfo attachment:(AttachmentModel *)attachment {
// 🔧 Turbo Mode
if (!self.turboGiftEffectsEnabled) {
NSLog(@"🎮 RoomAnimationView 礼物特效已关闭,跳过动画");
return;
}
if (!self.hostDelegate.getRoomInfo.hasAnimationEffect) {
return;
}
@@ -3786,6 +3877,89 @@ BannerSchedulerDelegate
NSLog(@"🔄 缓存管理器清理完成");
}
// 🔧
- (void)cleanupGiftEffects {
NSLog(@"🎮 清理礼物特效");
//
if (self.isPlayingGiftEffect) {
self.isPlayingGiftEffect = NO;
}
//
if (self.pagGiftEffectView && self.pagGiftEffectView.superview) {
[self.pagGiftEffectView stop];
[self.pagGiftEffectView removeFromSuperview];
}
if (self.vapGiftEffectView && self.vapGiftEffectView.superview) {
[self.vapGiftEffectView stopHWDMP4];
[self.vapGiftEffectView removeFromSuperview];
}
if (self.vggGiftEffectView && self.vggGiftEffectView.superview) {
[self.vggGiftEffectView stopAnimation];
[self.vggGiftEffectView removeFromSuperview];
}
//
[self.svgaQueue removeAllObjects];
NSLog(@"🎮 礼物特效清理完成");
}
// 🔧 banner
- (void)cleanupGiftBanners {
NSLog(@"🎮 清理礼物相关banner");
// banner
NSMutableArray *viewsToRemove = [NSMutableArray array];
for (UIView *subview in self.bannerContainer.subviews) {
if ([subview isKindOfClass:[BravoGiftBannerView class]] ||
[subview isKindOfClass:[LuckyGiftWinningBannerView class]] ||
[subview isKindOfClass:[RoomHighValueGiftBannerAnimation class]]) {
[viewsToRemove addObject:subview];
}
}
for (UIView *view in viewsToRemove) {
[view removeFromSuperview];
}
// banner
if (self.isRoomBannerV2Displaying) {
self.isRoomBannerV2Displaying = NO;
[self.bannerScheduler markBannerFinished];
}
NSLog(@"🎮 礼物相关banner清理完成");
}
// 🔧 banner
- (void)cleanupGameBanners {
NSLog(@"🎮 清理游戏相关banner");
// banner
NSMutableArray *viewsToRemove = [NSMutableArray array];
for (UIView *subview in self.bannerContainer.subviews) {
if ([subview isKindOfClass:[GameUniversalBannerView class]]) {
[viewsToRemove addObject:subview];
}
}
for (UIView *view in viewsToRemove) {
[view removeFromSuperview];
}
// banner
if (self.isRoomBannerV2Displaying) {
self.isRoomBannerV2Displaying = NO;
[self.bannerScheduler markBannerFinished];
}
NSLog(@"🎮 游戏相关banner清理完成");
}
- (void)cleanupBannerScheduler {
if (self.bannerScheduler) {
NSLog(@"<22><> 清理 BannerScheduler");
@@ -3806,6 +3980,11 @@ BannerSchedulerDelegate
// 🔧
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"RoomTypeChanged" object:nil];
// 🔧 Turbo Mode
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGiftEffectsEnabledChanged object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGlobalGiftScreenEnabledChanged object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self name:kTurboGlobalGameScreenEnabledChanged object:nil];
//
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -4023,6 +4202,45 @@ BannerSchedulerDelegate
}
}
// 🔧 Turbo Mode
- (void)handleTurboGiftEffectsChanged:(NSNotification *)notification {
BOOL enabled = [notification.userInfo[@"on"] boolValue];
self.turboGiftEffectsEnabled = enabled;
//
if (!enabled) {
[self cleanupGiftEffects];
}
NSLog(@"🎮 RoomAnimationView 礼物特效状态变化: %@", enabled ? @"开启" : @"关闭");
}
// 🔧 Turbo Mode
- (void)handleTurboGlobalGiftScreenChanged:(NSNotification *)notification {
BOOL enabled = [notification.userInfo[@"on"] boolValue];
self.turboGlobalGiftScreenEnabled = enabled;
// banner
if (!enabled) {
[self cleanupGiftBanners];
}
NSLog(@"🎮 RoomAnimationView 全局礼物屏幕状态变化: %@", enabled ? @"开启" : @"关闭");
}
// 🔧 Turbo Mode
- (void)handleTurboGlobalGameScreenChanged:(NSNotification *)notification {
BOOL enabled = [notification.userInfo[@"on"] boolValue];
self.turboGlobalGameScreenEnabled = enabled;
// banner
if (!enabled) {
[self cleanupGameBanners];
}
NSLog(@"🎮 RoomAnimationView 全局游戏屏幕状态变化: %@", enabled ? @"开启" : @"关闭");
}
// 🔧
- (BOOL)hasImportantAnimationPlaying {
// topContainer

View File

@@ -0,0 +1,24 @@
//
// XPTurboModeAction.h
// YuMi
//
// Created by P on 2025/9/2.
//
#import "../Model/XPRoomMoreMenuAction.h"
NS_ASSUME_NONNULL_BEGIN
/**
* Turbo模式操作
*/
@interface XPRoomEffectAction : XPRoomMoreMenuAction
/**
* 创建Turbo模式操作
*/
+ (instancetype)action;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,21 @@
//
// XPTurboModeAction.m
// YuMi
//
// Created by P on 2025/9/2.
//
#import "XPRoomEffectAction.h"
@implementation XPRoomEffectAction
+ (instancetype)action {
XPRoomEffectAction *action = [[XPRoomEffectAction alloc] init];
action.title = YMLocalizedString(@"20.20.62_text_14");
action.imageName = @"room_more_menu_gift_effect";
action.type = RoomMoreMenuType_Turbo_Mode;
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
return action;
}
@end

View File

@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
*
*/
@interface XPGiftEffectAction : XPRoomMoreMenuAction
@interface XPTurboModeAction : XPRoomMoreMenuAction
/**
*

View File

@@ -5,25 +5,25 @@
// Created by Linus on 2025/1/13.
//
#import "XPGiftEffectAction.h"
#import "XPTurboModeAction.h"
#import "RoomInfoModel.h"
@implementation XPGiftEffectAction
@implementation XPTurboModeAction
+ (instancetype)openAction {
XPGiftEffectAction *action = [[XPGiftEffectAction alloc] init];
action.title = YMLocalizedString(@"XPMoreMenuPresenter5");
action.imageName = @"room_more_menu_gift_effect";
action.type = RoomMoreMenuType_Gift_Effect_Open;
XPTurboModeAction *action = [[XPTurboModeAction alloc] init];
action.title = YMLocalizedString(@"20.20.62_text_9.1");
action.imageName = @"icon_turbo_mode";
action.type = RoomMoreMenuType_UI_Effect_Open;
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
return action;
}
+ (instancetype)closeAction {
XPGiftEffectAction *action = [[XPGiftEffectAction alloc] init];
action.title = YMLocalizedString(@"XPMoreMenuPresenter28");
action.imageName = @"room_more_menu_gift_effect";
action.type = RoomMoreMenuType_Gift_Effect_Close;
XPTurboModeAction *action = [[XPTurboModeAction alloc] init];
action.title = YMLocalizedString(@"20.20.62_text_9.2");
action.imageName = @"icon_turbo_mode";
action.type = RoomMoreMenuType_UI_Effect_Close;
action.titleColor = [DJDKMIMOMColor appCellBackgroundColor];
return action;
}

View File

@@ -15,6 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
/**
* 房间更多菜单操作工厂类
* 负责根据上下文创建合适的操作列表
* 原意是替换通过 action 替换 item model并将点击后的事件也封装到 action
*/
@interface XPRoomMoreMenuActionFactory : NSObject
@@ -23,13 +24,18 @@ NS_ASSUME_NONNULL_BEGIN
* @param context 操作上下文
* @return 操作列表
*/
//+ (NSArray<XPRoomMoreMenuAction *> *)createActionsWithContext:(XPRoomMoreMenuActionContext *)context;
/// 超管直接回使用固定组合 models (trumpet, giftEffect, appManager, report)
+ (NSArray<XPRoomMoreMenuAction *> *)createSuperAdminActionsWithContext:(XPRoomMoreMenuActionContext *)context;
+ (NSArray<XPRoomMoreMenuAction *> *)createPanelActionsWithContext:(XPRoomMoreMenuActionContext *)context isCreator:(BOOL)isCreator isManager:(BOOL)isManager isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic;
/// 普通用户需要综合判断
+ (NSArray<XPRoomMoreMenuAction *> *)createPanelActionsWithContext:(XPRoomMoreMenuActionContext *)context
isCreator:(BOOL)isCreator
isManager:(BOOL)isManager
isSuperAdmin:(BOOL)isSuperAdmin
isOnMic:(BOOL)isOnMic;
/// 没有取到云信用户数据的情况
+ (NSArray<XPRoomMoreMenuAction *> *)createPanelActionsForNoCharRoomMembersWithContext:(XPRoomMoreMenuActionContext *)context;
@end

View File

@@ -8,7 +8,7 @@
#import "XPRoomMoreMenuActionFactory.h"
#import "XPRoomMoreMenuActionContext.h"
#import "XPRoomMoreMenuAction.h"
#import "XPGiftEffectAction.h"
#import "XPTurboModeAction.h"
#import "XPRoomSettingAction.h"
#import "XPRoomBackGroundSettingAction.h"
#import "XPSocialAction.h"
@@ -19,6 +19,7 @@
#import "XPRoomRoomPhotoAction.h"
#import "XPRoomAppManagerAction.h"
#import "XPRoomCleanMessagesAction.h"
#import "XPRoomEffectAction.h"
#import "RoomInfoModel.h"
#import "ClientConfig.h"
@@ -28,7 +29,7 @@
NSMutableArray *actions = [NSMutableArray array];
[actions addObject:[XPSocialAction trumpetAction]];
[actions addObject:[XPGiftEffectAction actionWithRoomInfo:context.roomInfo]];
[actions addObject:[XPTurboModeAction actionWithRoomInfo:context.roomInfo]];
[actions addObject:[XPRoomAppManagerAction action]];
[actions addObject:[XPSocialAction reportAction]];
@@ -43,25 +44,30 @@
NSMutableArray *actions = [NSMutableArray array];
RoomInfoModel *roomInfo = context.roomInfo;
RoomType type = roomInfo.type;
BOOL userNotNormal = (isCreator || isManager || isSuperAdmin);
// 1. PK -
if ((isCreator || isManager || isSuperAdmin) &&
if (userNotNormal &&
type != RoomType_MiniGame && type != RoomType_Anchor) {
[actions addObject:[XPPKAction roomPKActionWithRoomInfo:roomInfo]];
}
if (isCreator && type != RoomType_MiniGame && type != RoomType_Anchor) {
if (isCreator &&
type != RoomType_MiniGame &&
type != RoomType_Anchor) {
[actions addObject:[XPPKAction corssPKActionWithRoomInfo:roomInfo]];
}
if (isCreator && type == RoomType_Anchor) {
if (isCreator &&
type == RoomType_Anchor) {
[actions addObject:[XPPKAction anchorPKActionWithRoomInfo:roomInfo]];
}
// 2. -
if ((isCreator || isManager || isSuperAdmin) &&
if (userNotNormal &&
roomInfo.canOpenBlindDate &&
type != RoomType_Anchor && type != RoomType_MiniGame) {
type != RoomType_Anchor &&
type != RoomType_MiniGame) {
[actions insertObject:[XPPKAction blindActionWithRoomInfo:roomInfo] atIndex:0];
}
@@ -71,25 +77,26 @@
}
// 4. -
if (isCreator || isManager || isSuperAdmin) {
if (userNotNormal) {
[actions addObject:[XPSocialAction trumpetAction]];
[actions addObject:[XPGiftEffectAction actionWithRoomInfo:roomInfo]];
[actions addObject:[XPRoomEffectAction action]];
[actions addObject:[XPRoomSettingAction action]];
[actions addObject:[XPRoomBackGroundSettingAction action]];
[actions addObject:[XPRoomCleanMessagesAction action]];
} else {
[actions addObject:[XPSocialAction trumpetAction]];
[actions addObject:[XPGiftEffectAction actionWithRoomInfo:roomInfo]];
[actions addObject:[XPRoomEffectAction action]];
}
// 5.
[actions addObject:[XPSocialAction reportAction]];
// 6.
if ((isCreator || isManager || isSuperAdmin) &&
if (userNotNormal &&
roomInfo.isPermitRoom != PermitRoomType_License &&
roomInfo.roomModeType != RoomModeType_Open_Blind &&
type != RoomType_MiniGame && type != RoomType_Anchor) {
type != RoomType_MiniGame &&
type != RoomType_Anchor) {
[actions addObject:[XPRoomTypeSettingAction action]];
}
@@ -100,10 +107,14 @@
}
// 8. -
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) {
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open &&
roomInfo.redEnvelopeOpen) {
[actions insertObject:[XPRoomRedPacketAction action] atIndex:1];
}
// 9.
[actions addObject:[XPTurboModeAction actionWithRoomInfo:roomInfo]];
return actions;
}
@@ -128,7 +139,7 @@
NSMutableArray *actions = [NSMutableArray array];
[actions addObject:[XPSocialAction trumpetAction]];
[actions addObject:[XPGiftEffectAction actionWithRoomInfo:context.roomInfo]];
[actions addObject:[XPTurboModeAction actionWithRoomInfo:context.roomInfo]];
[actions addObject:[XPRoomAppManagerAction action]];
[actions addObject:[XPSocialAction reportAction]];

View File

@@ -19,9 +19,9 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
// ///公屏开启
// RoomMoreMenuType_Message_Screen_Open = 4,
// ///我的礼物特效关闭
RoomMoreMenuType_Gift_Effect_Close = 5,
RoomMoreMenuType_UI_Effect_Close = 5,
///我的礼物特效开启
RoomMoreMenuType_Gift_Effect_Open = 6,
RoomMoreMenuType_UI_Effect_Open = 6,
///房间设置
RoomMoreMenuType_Room_Setting = 7,
///邀请粉丝
@@ -66,6 +66,8 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
RoomMoreMenuType_Room_Music_Panel = 27,
RoomMoreMenuType_App_Manager = 28,
RoomMoreMenuType_Turbo_Mode = 29,
};
@interface XPRoomMoreItemModel : PIBaseModel

View File

@@ -11,26 +11,12 @@ NS_ASSUME_NONNULL_BEGIN
@class RoomInfoModel;
@interface XPMoreMenuPresenter : BaseMvpPresenter
///获取更多菜单
- (void)getMoreMenuDataSourceWithNewArchitecture:(RoomInfoModel *)roomInfo
isSuperAdmin:(BOOL)isSuperAdmin
isOnMic:(BOOL)isOnMic
isAppSuperAdmin:(BOOL)isAppSuperAdmin;
///获取更多菜单
- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin;
/// 开启房间礼物值
/// @param roomUid 房间的uid
- (void)openRoomGiftValue:(NSString *)roomUid;
/// 关闭房间礼物值
/// @param roomUid 房间的uid
- (void)closeRoomGiftValue:(NSString *)roomUid;
/// 更新公屏状态
/// @param isCloseScreen 是否关闭公屏
/// @param roomId 房间的id
- (void)updateRoomMessageScreenState:(BOOL)isCloseScreen roomId:(NSString *)roomId;
/// 开启相亲模式
/// @param roomUid 房主的uid
@@ -43,8 +29,10 @@ NS_ASSUME_NONNULL_BEGIN
///获取房间广播模板内容
/// @param type 房间类型
- (void)getRoomRadioMessageListWithType:(NSString *)type;
/// 获取房间VIP小喇叭信息
- (void)getRoomgetUserVipRoomTrumpet:(NSString *)roomUid;
///结束个播跨房PK
- (void)requestFinishAnchorPK:(NSString *)roundId;

View File

@@ -56,7 +56,7 @@
isOnMic:(BOOL)isOnMic
isAppSuperAdmin:(BOOL)isAppSuperAdmin {
//
XPRoomMoreMenuActionContext *context = [XPRoomMoreMenuActionContext
XPRoomMoreMenuActionContext *context = [XPRoomMoreMenuActionContext
contextWithRoomInfo:roomInfo
userInfo:nil
hostDelegate:nil
@@ -65,35 +65,35 @@
isSuperAdmin:isSuperAdmin
isAppSuperAdmin:isAppSuperAdmin];
if (isAppSuperAdmin) {
// 使
NSArray<XPRoomMoreMenuAction *> *actions = [XPRoomMoreMenuActionFactory createSuperAdminActionsWithContext:context];
if (isAppSuperAdmin) {
// 使
NSArray<XPRoomMoreMenuAction *> *actions = [XPRoomMoreMenuActionFactory createSuperAdminActionsWithContext:context];
[self convertActionsToModels:actions];
} else {
//
@kWeakify(self);
[self loadNIMMemberData:^(NSArray<NIMChatroomMember *> * _Nullable members) {
@kStrongify(self);
BOOL isCreator = NO;
BOOL isManager = NO;
if (members && members.count > 0) {
NIMChatroomMember *member = members.firstObject;
isCreator = member.type == NIMChatroomMemberTypeCreator;
isManager = member.type == NIMChatroomMemberTypeManager;
}
NSArray<XPRoomMoreMenuAction *> *actions = [XPRoomMoreMenuActionFactory
createPanelActionsWithContext:context
isCreator:isCreator
isManager:isManager
isSuperAdmin:isSuperAdmin
isOnMic:isOnMic];
[self convertActionsToModels:actions];
} else {
//
@kWeakify(self);
[self loadNIMMemberData:^(NSArray<NIMChatroomMember *> * _Nullable members) {
@kStrongify(self);
BOOL isCreator = NO;
BOOL isManager = NO;
if (members && members.count > 0) {
NIMChatroomMember *member = members.firstObject;
isCreator = member.type == NIMChatroomMemberTypeCreator;
isManager = member.type == NIMChatroomMemberTypeManager;
}
NSArray<XPRoomMoreMenuAction *> *actions = [XPRoomMoreMenuActionFactory
createPanelActionsWithContext:context
isCreator:isCreator
isManager:isManager
isSuperAdmin:isSuperAdmin
isOnMic:isOnMic];
[self convertActionsToModels:actions];
} withRoomInfo:roomInfo];
}
} withRoomInfo:roomInfo];
}
}
// Action
@@ -105,237 +105,6 @@
[[self getView] getMoreMenuDataSuccess:models];
}
- (void)getMoreMenuDataSource:(RoomInfoModel *)roomInfo isSuperAdmin:(BOOL)isSuperAdmin isOnMic:(BOOL)isOnMic isAppSuperAdmin:(BOOL)isAppSuperAdmin{
XPRoomMoreItemModel * roomPK = [[XPRoomMoreItemModel alloc] init];
roomPK.title = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ?YMLocalizedString(@"XPMoreMenuPresenter26") : YMLocalizedString(@"XPMoreMenuPresenter1");
roomPK.imageName= @"room_pk_menu_icon";
roomPK.type = roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? RoomMoreMenuType_Room_PK_Close : RoomMoreMenuType_Room_PK_Open;
roomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init];
acrossRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter30") : YMLocalizedString(@"XPMoreMenuPresenter31");
acrossRoomPK.imageName = @"crossroom_pk_menu_icon";
acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open;
acrossRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel *bgValue = [[XPRoomMoreItemModel alloc] init];
bgValue.title = YMLocalizedString(@"1.0.18_0");
bgValue.imageName= @"room_menu_background";
bgValue.type = RoomMoreMenuType_Room_Type_Background;
bgValue.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * giftEffect = [[XPRoomMoreItemModel alloc] init];
giftEffect.title = roomInfo.hasAnimationEffect ? YMLocalizedString(@"XPMoreMenuPresenter28") : YMLocalizedString(@"XPMoreMenuPresenter5");
giftEffect.imageName = @"room_more_menu_gift_effect";
giftEffect.type = roomInfo.hasAnimationEffect ? RoomMoreMenuType_Gift_Effect_Close : RoomMoreMenuType_Gift_Effect_Open;
giftEffect.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * dating = [[XPRoomMoreItemModel alloc] init];
dating.title = roomInfo.roomModeType == RoomModeType_Open_Blind ? YMLocalizedString(@"XPMoreMenuPresenter29") : YMLocalizedString(@"XPMoreMenuPresenter8");
dating.imageName = @"room_more_menu_dating";
dating.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomMoreMenuType_Room_Dating_Close : RoomMoreMenuType_Room_Dating_Open;
dating.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * anchorRoomPK = [[XPRoomMoreItemModel alloc] init];
anchorRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? YMLocalizedString(@"XPMoreMenuPresenter32") : YMLocalizedString(@"XPMoreMenuPresenter33");
anchorRoomPK.imageName = @"room_more_menu_anchor_pk";
anchorRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Anchor_PK_Close : RoomMoreMenuType_Room_Anchor_PK_Open;
anchorRoomPK.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
if (roomInfo.pkState == AcrossRoomPkStateTypePenalty) {
if ([roomInfo.winUid isEqualToString:[AccountInfoStorage instance].getUid]) {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15");
} else if ([roomInfo.winUid isEqualToString:roomInfo.pkUid]) {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter14");
} else {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15");
}
} else if (roomInfo.pkState == AcrossRoomPkStateTypePenaltyEnd) {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter15");
}
if (roomInfo.pkMatchStartTime) {
anchorRoomPK.title = YMLocalizedString(@"XPMoreMenuPresenter17");
}
XPRoomMoreItemModel * clearScreen = [[XPRoomMoreItemModel alloc] init];
clearScreen.title = YMLocalizedString(@"XPMoreMenuPresenter20");
clearScreen.imageName = @"room_more_menu_message_clean";
clearScreen.type = RoomMoreMenuType_Message_Screen_Clear;
clearScreen.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * roomSetting = [[XPRoomMoreItemModel alloc] init];
roomSetting.title = YMLocalizedString(@"XPMoreMenuPresenter21");
roomSetting.imageName = @"room_more_menu_setting";
roomSetting.type = RoomMoreMenuType_Room_Setting;
roomSetting.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * trumpet = [[XPRoomMoreItemModel alloc] init];
trumpet.title = YMLocalizedString(@"XPMoreMenuPresenter35");
trumpet.imageName = @"room_more_menu_trumpet";
trumpet.type = RoomMoreMenuType_Room_trumpet;
trumpet.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * redPacket = [[XPRoomMoreItemModel alloc] init];
redPacket.title = YMLocalizedString(@"XPMoreMenuPresenter24");
redPacket.imageName = @"pi_red_packet_entrance";
redPacket.type = RoomMoreMenuType_Room_redPacket;
redPacket.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * report = [[XPRoomMoreItemModel alloc] init];
report.title = YMLocalizedString(@"XPMoreMenuPresenter36");
report.imageName = @"room_info_report";
report.type = RoomMoreMenuType_Room_report;
report.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * roomPhotoAlbum = [[XPRoomMoreItemModel alloc] init];
roomPhotoAlbum.title = YMLocalizedString(@"XPMoreMenuPresenter37");
roomPhotoAlbum.imageName = @"room_info_photo_album";
roomPhotoAlbum.type = RoomMoreMenuType_Room_Room_Photo_Album;
roomPhotoAlbum.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * roomTypeSetting = [[XPRoomMoreItemModel alloc] init];
roomTypeSetting.title = YMLocalizedString(@"XPMoreMenuPresenter25");
roomTypeSetting.imageName = @"room_type_selection_icon";
roomTypeSetting.type = RoomMoreMenuType_Room_Type_Setting;
roomTypeSetting.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel * musicPanel = [[XPRoomMoreItemModel alloc] init];
musicPanel.title = YMLocalizedString(@"XPRoomMusicVoiceSettingView1");
musicPanel.imageName = @"menu_music";
musicPanel.type = RoomMoreMenuType_Room_Music_Panel;
musicPanel.titleColor = [DJDKMIMOMColor roomMoreMenuTextColor];
XPRoomMoreItemModel *appManager = [[XPRoomMoreItemModel alloc] init];
appManager.type = RoomMoreMenuType_App_Manager;
appManager.title = YMLocalizedString(@"1.0.34_text_1");
appManager.imageName = @"app_admin_icon";
appManager.titleColor = [UIColor orangeColor];
NSString * uid = [AccountInfoStorage instance].getUid;
if (uid.length <= 0) {
return;
}
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = roomId;
request.userIds = @[uid];
if (isAppSuperAdmin) {
NSMutableArray * array = [NSMutableArray array];
[array addObject:trumpet];
[array addObject:giftEffect];
[array addObject:appManager];
[array addObject:report];
[[self getView] getMoreMenuDataSuccess:array];
return;
}
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
NSMutableArray * array = [NSMutableArray array];
BOOL isCreator = NO;
BOOL isManager = NO;
NSInteger indexOfRoomAlbum = 0;
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
isCreator = member.type == NIMChatroomMemberTypeCreator;
isManager = member.type == NIMChatroomMemberTypeManager;
if ((isCreator || isManager || isSuperAdmin) && roomInfo.type != RoomType_MiniGame && roomInfo.type != RoomType_Anchor) {
[array addObject:roomPK];
indexOfRoomAlbum += 1;
}
if (isCreator && roomInfo.type != RoomType_MiniGame) {
if(roomInfo.type != RoomType_Anchor){
[array addObject:acrossRoomPK];
indexOfRoomAlbum += 1;
}
}
if (isOnMic) {
[array addObject:musicPanel];
indexOfRoomAlbum += 1;
}
if (isCreator && roomInfo.type == RoomType_Anchor) {
[array addObject:anchorRoomPK];
indexOfRoomAlbum += 1;
}
if (isCreator || isManager || isSuperAdmin) {
if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) {
[array insertObject:dating atIndex:0];
indexOfRoomAlbum += 1;
}
[array addObject:trumpet];
[array addObject:giftEffect];
[array addObject:roomSetting];
if (isCreator || isManager || isSuperAdmin) {
[array addObject:bgValue];
indexOfRoomAlbum += 1;
}
[array addObject:clearScreen];
} else {
[array addObject:trumpet];
[array addObject:giftEffect];
}
}else{
[array addObject:giftEffect];
}
[array addObject:report];
if ((isCreator || isManager || isSuperAdmin) && // &
roomInfo.isPermitRoom != PermitRoomType_License && //
roomInfo.roomModeType != RoomModeType_Open_Blind && //
roomInfo.type != RoomType_MiniGame && // 10/15
roomInfo.type != RoomType_Anchor) {
[array addObject:roomTypeSetting];
}
if(roomInfo.hasRoomAlbum == YES){
[array insertObject:roomPhotoAlbum atIndex:indexOfRoomAlbum];
}
if ([ClientConfig shareConfig].configInfo.redEnvelopeConfig.open && roomInfo.redEnvelopeOpen) {
[array insertObject:redPacket atIndex:1];
}
[[self getView] getMoreMenuDataSuccess:array];
}];
}
///
/// @param roomUid uid
- (void)openRoomGiftValue:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api openRoomGiftValue:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] openRoomGiftValueSuccess];
}] uid:uid roomUid:roomUid];
}
///
/// @param roomUid uid
- (void)closeRoomGiftValue:(NSString *)roomUid {
NSString * uid = [AccountInfoStorage instance].getUid;
[Api closeRoomGiftValue:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
[[self getView] closeRoomGiftValueSuccess];
}fail:^(NSInteger code, NSString * _Nullable msg) {
// NSLog(@"%@",msg);
}] uid:uid roomUid:roomUid];
}
///
/// @param isCloseScreen
/// @param roomId id
- (void)updateRoomMessageScreenState:(BOOL)isCloseScreen roomId:(NSString *)roomId {
NSString * uid = [AccountInfoStorage instance].getUid;
NSString * ticket = [AccountInfoStorage instance].getTicket;
NSString * isCleScreenStr = isCloseScreen ? @"1" : @"0";
[Api updateRoomInfoMessageState:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
RoomInfoModel * roomInfo = [RoomInfoModel modelWithDictionary:data.data];
[[self getView] updateRoomMessageScreenStateSuccess:roomInfo];
}] roomId:roomId isCloseScreen:isCleScreenStr ticket:ticket uid:uid];
}
///
/// @param roomUid uid
- (void)openRoomDating:(NSString *)roomUid {

View File

@@ -51,8 +51,15 @@
#import "XPRoomMoreMenuAction.h"
#import "XPPKAction.h"
#import "XPTurboModeViewController.h"
#import "XPTurboModeConstants.h"
#import "XPRoomSettingPresenter.h"
UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
// 🔧 Turbo Mode
extern NSString *const kTurboModeButtonStateChanged;
@interface XPRoomMoreMenuViewController ()<UICollectionViewDelegate, UICollectionViewDataSource,XPMoreMenuProtocol>
///View
@property (nonatomic,strong) UIView * topView;
@@ -70,10 +77,100 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
@property (nonatomic,assign) id<RoomHostDelegate> hostDelegate;
@property(nonatomic, assign) BOOL isOnMic;
// 🔧 Turbo_Mode
@property (nonatomic, strong) UIButton *turboModeButton;
@end
@implementation XPRoomMoreMenuViewController
// 🔧 Turbo_Mode
- (void)setupTurboModeButton {
self.turboModeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.turboModeButton setTitle:YMLocalizedString(@"20.20.62_text_9") forState:UIControlStateNormal];
[self.turboModeButton setImage:[UIImage imageNamed:@"icon_turbo_mode"] forState:UIControlStateNormal];
[self.turboModeButton addTarget:self action:@selector(turboModeButtonTapped) forControlEvents:UIControlEventTouchUpInside];
//
self.turboModeButton.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.8];
self.turboModeButton.layer.cornerRadius = 8;
self.turboModeButton.titleLabel.font = [UIFont systemFontOfSize:14];
[self.view addSubview:self.turboModeButton];
// - 使 Masonry
[self.turboModeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.topView.mas_bottom).offset(20);
make.centerX.mas_equalTo(self.view);
make.width.mas_equalTo(120);
make.height.mas_equalTo(40);
}];
//
[self updateTurboModeButtonStateOnRoomEnter];
}
// 🔧 Turbo Mode
- (void)setupTurboModeNotifications {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(handleTurboModeButtonStateChanged:)
name:kTurboModeButtonStateChanged
object:nil];
}
// 🔧 Turbo Mode
- (void)handleTurboModeButtonStateChanged:(NSNotification *)notification {
BOOL allOn = [notification.userInfo[@"allOn"] boolValue];
[self updateTurboModeButtonState:allOn];
}
// 🔧 Turbo Mode
- (void)updateTurboModeButtonState:(BOOL)allOn {
if (allOn) {
[self.turboModeButton setTitleColor:[UIColor greenColor] forState:UIControlStateNormal];
self.turboModeButton.backgroundColor = [UIColor colorWithRed:0.2 green:0.8 blue:0.2 alpha:0.8];
} else {
[self.turboModeButton setTitleColor:[UIColor grayColor] forState:UIControlStateNormal];
self.turboModeButton.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.8];
}
}
// 🔧 Turbo Mode
- (void)turboModeButtonTapped {
// Turbo
[self dismissViewControllerAnimated:NO completion:nil];
XPTurboModeViewController *vc = [[XPTurboModeViewController alloc] init];
vc.roomInfo = self.roomInfo;
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:vc
animated:YES
completion:nil];
}
// 🔧
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self updateTurboModeButtonStateOnRoomEnter];
}
- (void)updateTurboModeButtonStateOnRoomEnter {
NSString *roomId = @(self.roomInfo.roomId).stringValue;
//
BOOL giftEffectsEnabled = self.roomInfo.hasAnimationEffect;
BOOL globalGiftScreenEnabled = [[NSUserDefaults standardUserDefaults]
boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] ?: YES;
BOOL globalGameScreenEnabled = [[NSUserDefaults standardUserDefaults]
boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] ?: YES;
BOOL allOn = giftEffectsEnabled && globalGiftScreenEnabled && globalGameScreenEnabled;
[self updateTurboModeButtonState:allOn];
}
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate isUserOnMic:(BOOL)isOnMic {
if (self = [super init]) {
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
@@ -91,6 +188,8 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
- (void)viewDidLoad {
[super viewDidLoad];
[self initSubViews];
// [self setupTurboModeButton];
[self setupTurboModeNotifications];
[self initSubViewConstraints];
///
@@ -101,10 +200,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
break;
}
}
// [self.presenter getMoreMenuDataSource:self.roomInfo
// isSuperAdmin:meIsSuperAdmin
// isOnMic:self.isOnMic
// isAppSuperAdmin:[self.hostDelegate.getUserInfo platformRole]==1];
[self.presenter getMoreMenuDataSourceWithNewArchitecture:self.roomInfo
isSuperAdmin:meIsSuperAdmin
@@ -156,6 +251,7 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
self.datasource = list;
[self.collectionView reloadData];
CGFloat contentHeight= 24 + 36;
CGFloat itemHeight = 50;
int page = list.count % 5;
@@ -166,7 +262,9 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
contentHeight += ((scale+1) *itemHeight + scale * 12);
}
CAShapeLayer * layer = [CAShapeLayer layer];
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(8, 8)];
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight)
byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight
cornerRadii:CGSizeMake(8, 8)];
layer.path = path.CGPath;
self.collectionView.layer.mask = layer;
[self.collectionView mas_updateConstraints:^(MASConstraintMaker *make) {
@@ -253,9 +351,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid];
[self.hostDelegate.getCurrentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
// XPAnchorPKSelectTypeController *selectVc = [[XPAnchorPKSelectTypeController alloc] initWithRoomUid:roomUid];
// [self.hostDelegate.getCurrentNav presentViewController:selectVc animated:YES completion:nil];
}
#pragma mark - UICollectionViewDelegate And UICollectionViewDatasource
@@ -282,19 +377,54 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
NSString * roomUid = [NSString stringWithFormat:@"%ld",self.roomInfo.uid];
switch (item.type) {
case RoomMoreMenuType_Gift_Effect_Open:
case RoomMoreMenuType_UI_Effect_Open:
case RoomMoreMenuType_UI_Effect_Close:
{
[self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController4")];
NSDictionary * dic = @{@"hasAnimationEffect": @(1)};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
[self dismissViewControllerAnimated:YES completion:nil];
}
break;
case RoomMoreMenuType_Gift_Effect_Close:
{
[self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController5")];
NSDictionary * dic = @{@"hasAnimationEffect": @(0)};
[[NSNotificationCenter defaultCenter] postNotificationName:kRoomGiftEffectUpdateNotificationKey object:dic];
BOOL newOn = !self.roomInfo.hasAnimationEffect;
// key Turbo
NSUserDefaults *ud = [NSUserDefaults standardUserDefaults];
[ud setBool:newOn forKey:@"kTurboGlobalGiftScreenEnabled"];
[ud setBool:newOn forKey:@"kTurboGlobalGameScreenEnabled"];
[ud synchronize];
// 广
[[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGlobalGiftScreenEnabledChanged"
object:nil
userInfo:@{ @"on": @(newOn) }];
[[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGlobalGameScreenEnabledChanged"
object:nil
userInfo:@{ @"on": @(newOn) }];
// 广
[[NSNotificationCenter defaultCenter] postNotificationName:@"kTurboGiftEffectsEnabledChanged"
object:nil
userInfo:@{ @"on": @(newOn) }];
// hasAnimationEffect
XPRoomSettingPresenter *p = [[XPRoomSettingPresenter alloc] init];
RoomInfoModel *ri = self.roomInfo;
[p updateRoomInfo:ri.title
roomPwd:ri.roomPwd
tagId:ri.roomTag
classifyId:ri.singleRoomSortId
hasAnimationEffect:newOn
roomUid:@(ri.uid).stringValue
roomId:@(ri.roomId).stringValue
type:ri.type
itemType:RoomSettingItemType_Gift_Effect
mgId:@(ri.mgId).stringValue
backPic:ri.backPic
avatar:ri.avatar];
//
if (newOn) {
[self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController4")];
} else {
[self showSuccessToast:YMLocalizedString(@"XPRoomMoreMenuViewController5")];
}
// roomInfo
self.roomInfo.hasAnimationEffect = newOn;
[self dismissViewControllerAnimated:YES completion:nil];
}
break;
@@ -534,6 +664,16 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
[self.hostDelegate.getCurrentNav pushViewController:vc animated:YES];
}
break;
case RoomMoreMenuType_Turbo_Mode: {
[self dismissViewControllerAnimated:NO completion:nil];
XPTurboModeViewController *vc = [[XPTurboModeViewController alloc] init];
vc.roomInfo = self.roomInfo;
vc.modalPresentationStyle = UIModalPresentationOverFullScreen;
[self.hostDelegate.getCurrentNav presentViewController:vc
animated:YES
completion:nil];
}
break;
default:
break;
}
@@ -569,7 +709,6 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
_topView.backgroundColor = [UIColor clearColor];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMissRecognizer)];
tap.cancelsTouchesInView = NO;
tap.delegate = self;
[_topView addGestureRecognizer:tap];
}
return _topView;

View File

@@ -0,0 +1,55 @@
//
// XPTurboModeConstants.h
// YuMi
//
// Created by P on 2025/1/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// MARK: - 缓存 Key 生成函数
/**
* 生成礼物特效开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId);
/**
* 生成全局礼物屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId);
/**
* 生成全局游戏屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId);
// MARK: - 通知名称常量
/**
* 礼物特效开关状态改变通知
*/
extern NSString *const kTurboGiftEffectsEnabledChanged;
/**
* 全局礼物屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGiftScreenEnabledChanged;
/**
* 全局游戏屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGameScreenEnabledChanged;
/**
* Turbo Mode 按钮状态改变通知
*/
extern NSString *const kTurboModeButtonStateChanged;
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,27 @@
//
// XPTurboModeConstants.m
// YuMi
//
// Created by P on 2025/1/13.
//
#import "XPTurboModeConstants.h"
// MARK: - Key
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGiftEffects_%@", roomId];
}
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGiftScreen_%@", roomId];
}
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGameScreen_%@", roomId];
}
// MARK: -
NSString *const kTurboGiftEffectsEnabledChanged = @"kTurboGiftEffectsEnabledChanged";
NSString *const kTurboGlobalGiftScreenEnabledChanged = @"kTurboGlobalGiftScreenEnabledChanged";
NSString *const kTurboGlobalGameScreenEnabledChanged = @"kTurboGlobalGameScreenEnabledChanged";
NSString *const kTurboModeButtonStateChanged = @"kTurboModeButtonStateChanged";

View File

@@ -0,0 +1,23 @@
//
// XPTurboModeViewController.h
// YuMi
//
// Created by P on 2025/9/2.
//
#import "MvpViewController.h"
@class RoomInfoModel;
NS_ASSUME_NONNULL_BEGIN
/**
* Turbo模式设置控制器
*/
@interface XPTurboModeViewController : MvpViewController
@property (nonatomic, strong) RoomInfoModel *roomInfo;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,263 @@
//
// XPTurboModeViewController.m
// YuMi
//
// Created by Linus on 2025/1/13.
//
#import "XPTurboModeViewController.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "RoomInfoModel.h"
#import "XPTurboModeConstants.h"
@interface XPTurboModeViewController ()
@property (nonatomic, strong) UIView *bottomAreaBackground;
@property (nonatomic, strong) UIButton *dismissButton;
@property (nonatomic, strong) UILabel *titleLabel;
//
@property (nonatomic, strong) UISwitch *giftEffectsSwitch; //
@property (nonatomic, strong) UISwitch *globalGiftScreenSwitch; //
@property (nonatomic, strong) UISwitch *globalGameScreenSwitch; //
//
@property (nonatomic, assign) BOOL giftEffectsEnabled; //
@property (nonatomic, assign) BOOL globalGiftScreenEnabled; //
@property (nonatomic, assign) BOOL globalGameScreenEnabled; //
//
@property (nonatomic, strong) NSString *roomId; // ID
@end
@implementation XPTurboModeViewController
- (void)viewDidLoad {
[super viewDidLoad];
[self setupUI];
[self setupSwitchStates];
}
- (void)setupUI {
self.view.backgroundColor = [UIColor clearColor];
[self setupBottomArea];
[self setupDismissButton];
[self setupTitle];
[self setupSwitches];
}
- (void)setupBottomArea {
self.bottomAreaBackground = [[UIView alloc] init];
self.bottomAreaBackground.backgroundColor = [UIColor colorWithWhite:0.1 alpha:0.95];
self.bottomAreaBackground.layer.cornerRadius = 20;
self.bottomAreaBackground.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
[self.view addSubview:self.bottomAreaBackground];
// - 使 Masonry
[self.bottomAreaBackground mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.bottom.mas_equalTo(self.view);
make.height.mas_equalTo(300);
}];
}
- (void)setupDismissButton {
self.dismissButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.dismissButton setTitle:@"✕" forState:UIControlStateNormal];
[self.dismissButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
self.dismissButton.titleLabel.font = [UIFont systemFontOfSize:24];
[self.dismissButton addTarget:self action:@selector(dismissViewController) forControlEvents:UIControlEventTouchUpInside];
[self.bottomAreaBackground addSubview:self.dismissButton];
// - 使 Masonry
[self.dismissButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.bottomAreaBackground).offset(20);
make.trailing.mas_equalTo(self.bottomAreaBackground).offset(-20);
make.width.height.mas_equalTo(44);
}];
}
- (void)setupTitle {
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = YMLocalizedString(@"20.20.62_text_9"); // Turbo Mode
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.font = [UIFont boldSystemFontOfSize:18];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.bottomAreaBackground addSubview:self.titleLabel];
// - 使 Masonry
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.mas_equalTo(self.dismissButton);
make.centerX.mas_equalTo(self.bottomAreaBackground);
make.leading.mas_greaterThanOrEqualTo(self.bottomAreaBackground).offset(60);
make.trailing.mas_lessThanOrEqualTo(self.bottomAreaBackground).offset(-60);
}];
}
- (void)setupSwitches {
//
[self setupSwitchItem:YMLocalizedString(@"20.20.62_text_10") // Gift effects
switch:self.giftEffectsSwitch
atIndex:0];
//
[self setupSwitchItem:YMLocalizedString(@"20.20.62_text_11") // Global gift screen
switch:self.globalGiftScreenSwitch
atIndex:1];
//
[self setupSwitchItem:YMLocalizedString(@"20.20.62_text_12") // Global game screen
switch:self.globalGameScreenSwitch
atIndex:2];
}
- (void)setupSwitchItem:(NSString *)title
switch:(UISwitch *)switchControl
atIndex:(NSInteger)index {
UIView *switchView = [[UIView alloc] init];
switchView.backgroundColor = [UIColor colorWithWhite:0.2 alpha:0.8];
switchView.layer.cornerRadius = 12;
[self.bottomAreaBackground addSubview:switchView];
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.text = title;
titleLabel.textColor = [UIColor whiteColor];
titleLabel.font = [UIFont systemFontOfSize:16];
[switchView addSubview:titleLabel];
UISwitch *switchViewControl = [[UISwitch alloc] init];
switchViewControl.onTintColor = [UIColor systemBlueColor];
[switchView addSubview:switchViewControl];
// - 使 Masonry
[switchView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.bottomAreaBackground).offset(20);
make.trailing.mas_equalTo(self.bottomAreaBackground).offset(-20);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(30 + index * 70);
make.height.mas_equalTo(50);
}];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(switchView).offset(16);
make.centerY.mas_equalTo(switchView);
}];
[switchViewControl mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(switchView).offset(-16);
make.centerY.mas_equalTo(switchView);
}];
//
[switchViewControl addTarget:self action:@selector(switchValueChanged:) forControlEvents:UIControlEventValueChanged];
switchViewControl.tag = index;
// switch
if (index == 0) {
self.giftEffectsSwitch = switchViewControl;
} else if (index == 1) {
self.globalGiftScreenSwitch = switchViewControl;
} else if (index == 2) {
self.globalGameScreenSwitch = switchViewControl;
}
}
- (void)setupSwitchStates {
NSString *roomId = @(self.roomInfo.roomId).stringValue;
self.roomId = roomId;
//
self.giftEffectsEnabled = self.roomInfo.hasAnimationEffect;
// NSUserDefaults NO
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
id giftScreenObj = [defaults objectForKey:kTurboGlobalGiftScreenEnabledKey(roomId)];
self.globalGiftScreenEnabled = (giftScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGiftScreenEnabledKey(roomId)] : YES; //
id gameScreenObj = [defaults objectForKey:kTurboGlobalGameScreenEnabledKey(roomId)];
self.globalGameScreenEnabled = (gameScreenObj != nil) ? [defaults boolForKey:kTurboGlobalGameScreenEnabledKey(roomId)] : YES; //
//
self.giftEffectsSwitch.on = self.giftEffectsEnabled;
self.globalGiftScreenSwitch.on = self.globalGiftScreenEnabled;
self.globalGameScreenSwitch.on = self.globalGameScreenEnabled;
NSLog(@"🎮 Turbo Mode开关初始化完成 - 房间ID: %@, 礼物特效: %@, 全局礼物屏幕: %@, 全局游戏屏幕: %@",
roomId,
self.giftEffectsEnabled ? @"开启" : @"关闭",
self.globalGiftScreenEnabled ? @"开启" : @"关闭",
self.globalGameScreenEnabled ? @"开启" : @"关闭");
}
- (void)switchValueChanged:(UISwitch *)sender {
BOOL isOn = sender.isOn;
if (sender.tag == 0) { //
// roomInfo.hasAnimationEffect
self.giftEffectsEnabled = isOn;
// RoomAnimationView
[self sendTurboGiftEffectsNotification:isOn];
} else if (sender.tag == 1) { //
self.globalGiftScreenEnabled = isOn;
// ID
[[NSUserDefaults standardUserDefaults]
setBool:isOn forKey:kTurboGlobalGiftScreenEnabledKey(self.roomId)];
[[NSUserDefaults standardUserDefaults] synchronize];
[self sendTurboGlobalGiftScreenNotification:isOn];
} else if (sender.tag == 2) { //
self.globalGameScreenEnabled = isOn;
// ID
[[NSUserDefaults standardUserDefaults]
setBool:isOn forKey:kTurboGlobalGameScreenEnabledKey(self.roomId)];
[[NSUserDefaults standardUserDefaults] synchronize];
[self sendTurboGlobalGameScreenNotification:isOn];
}
// Turbo_Mode
[self notifyParentUpdateTurboModeButton];
NSLog(@"🎮 Turbo Mode开关变化 - 索引: %ld, 状态: %@", (long)sender.tag, isOn ? @"开启" : @"关闭");
}
- (void)notifyParentUpdateTurboModeButton {
BOOL allSwitchesOn = self.giftEffectsEnabled &&
self.globalGiftScreenEnabled &&
self.globalGameScreenEnabled;
[[NSNotificationCenter defaultCenter]
postNotificationName:kTurboModeButtonStateChanged
object:nil
userInfo:@{@"allOn": @(allSwitchesOn)}];
}
#pragma mark - Notification Methods
- (void)sendTurboGiftEffectsNotification:(BOOL)enabled {
[[NSNotificationCenter defaultCenter]
postNotificationName:kTurboGiftEffectsEnabledChanged
object:nil
userInfo:@{@"on": @(enabled)}];
}
- (void)sendTurboGlobalGiftScreenNotification:(BOOL)enabled {
[[NSNotificationCenter defaultCenter]
postNotificationName:kTurboGlobalGiftScreenEnabledChanged
object:nil
userInfo:@{@"on": @(enabled)}];
}
- (void)sendTurboGlobalGameScreenNotification:(BOOL)enabled {
[[NSNotificationCenter defaultCenter]
postNotificationName:kTurboGlobalGameScreenEnabledChanged
object:nil
userInfo:@{@"on": @(enabled)}];
}
- (void)dismissViewController {
[self dismissViewControllerAnimated:YES completion:nil];
}
@end

View File

@@ -0,0 +1,55 @@
//
// XPTurboModeConstants.h
// YuMi
//
// Created by P on 2025/1/13.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
// MARK: - 缓存 Key 生成函数
/**
* 生成礼物特效开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId);
/**
* 生成全局礼物屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId);
/**
* 生成全局游戏屏幕开关的缓存 Key
* @param roomId 房间 ID
* @return 格式化的缓存 Key
*/
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId);
// MARK: - 通知名称常量
/**
* 礼物特效开关状态改变通知
*/
extern NSString *const kTurboGiftEffectsEnabledChanged;
/**
* 全局礼物屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGiftScreenEnabledChanged;
/**
* 全局游戏屏幕开关状态改变通知
*/
extern NSString *const kTurboGlobalGameScreenEnabledChanged;
/**
* Turbo Mode 按钮状态改变通知
*/
extern NSString *const kTurboModeButtonStateChanged;
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,27 @@
//
// XPTurboModeConstants.m
// YuMi
//
// Created by P on 2025/1/13.
//
#import "XPTurboModeConstants.h"
// MARK: - Key
NSString *kTurboGiftEffectsEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGiftEffects_%@", roomId];
}
NSString *kTurboGlobalGiftScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGiftScreen_%@", roomId];
}
NSString *kTurboGlobalGameScreenEnabledKey(NSString *roomId) {
return [NSString stringWithFormat:@"TurboGlobalGameScreen_%@", roomId];
}
// MARK: -
NSString *const kTurboGiftEffectsEnabledChanged = @"kTurboGiftEffectsEnabledChanged";
NSString *const kTurboGlobalGiftScreenEnabledChanged = @"kTurboGlobalGiftScreenEnabledChanged";
NSString *const kTurboGlobalGameScreenEnabledChanged = @"kTurboGlobalGameScreenEnabledChanged";
NSString *const kTurboModeButtonStateChanged = @"kTurboModeButtonStateChanged";

View File

@@ -100,64 +100,21 @@
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
giftIdMapCache = [[NSCache alloc] init];
giftIdMapCache.countLimit = 50;
giftIdMapCache.countLimit = 100; //
});
NSDictionary<NSNumber *, GiftInfoModel *> *giftMap = [giftIdMapCache objectForKey:roomUid];
__block NSDictionary<NSNumber *, GiftInfoModel *> *giftMap = [giftIdMapCache objectForKey:roomUid];
if (!giftMap) {
//
NSMutableDictionary *map = [NSMutableDictionary new];
for (GiftInfoModel *gift in giftLists) {
map[@(gift.giftId)] = gift;
}
giftMap = [map copy];
[giftIdMapCache setObject:giftMap forKey:roomUid];
NSDictionary *newGiftMap = [map copy];
[giftIdMapCache setObject:newGiftMap forKey:roomUid];
giftMap = newGiftMap;
}
return giftMap[@(giftIdInt)];
// NSInteger giftIdInt = giftId.integerValue;
// NSArray<GiftInfoModel *> *giftLists = [self getRoomGiftDatasource:self.currentRoomUid];
// if (giftLists.count == 0) return nil;
//
// // giftLists giftId
// NSArray<GiftInfoModel *> *sortedGiftLists = [giftLists sortedArrayUsingComparator:^NSComparisonResult(GiftInfoModel *obj1, GiftInfoModel *obj2) {
// return [@(obj1.giftId) compare:@(obj2.giftId)];
// }];
//
// NSInteger left = 0, right = sortedGiftLists.count - 1;
// while (left <= right) {
// NSInteger mid = left + (right - left) / 2;
// if (sortedGiftLists[mid].giftId == giftIdInt) return sortedGiftLists[mid];
// if (sortedGiftLists[mid].giftId < giftIdInt) left = mid + 1;
// else right = mid - 1;
// }
// return nil;
// if (self.currentRoomUid) {
// NSArray<GiftInfoModel *> *giftLists = [self.roomGiftCache objectForKey:self.currentRoomUid];
// if (giftLists.count == 0) {
// giftLists = [self.roomGiftCache objectForKey:[self defaultKey]];
// }
// if (giftLists.count > 0) {
// NSInteger left = 0;
// NSInteger right = giftLists.count - 1;
//
// while (left <= right) {
// NSInteger mid = left + (right - left) / 2;
// GiftInfoModel *midObject = giftLists[mid];
//
// if (midObject.giftId == giftIdInt) {
// return midObject;
// } else if (midObject.giftId < giftIdInt) {
// left = mid + 1;
// } else {
// right = mid - 1;
// }
// }
// return nil; // nil
// }
// }
// return nil;
}

View File

@@ -94,7 +94,7 @@
editParam = [MSParamsDecode msDecodeParams:editParam];
params = [self configBaseParmars:editParam];
#if 0
#if DEBUG
// URL
NSString *baseUrl = [HttpRequestHelper getHostUrl];
NSString *fullUrl = [NSString stringWithFormat:@"%@/%@", baseUrl, method];
@@ -118,7 +118,7 @@
@kWeakify(self);
[manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject];
#if 0
#if DEBUG
NSLog(@"%@ - \n%@\n", method, [baseModel toJSONString]);
#else
#endif
@@ -338,7 +338,7 @@ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
params = [MSParamsDecode msDecodeParams:[params mutableCopy] ];
params = [self configBaseParmars:params];
AFHTTPSessionManager *manager = [HttpRequestHelper requestManager];
#if 0
#if DEBUG
// URL
NSString *baseUrl = [HttpRequestHelper getHostUrl];
NSString *fullUrl = [NSString stringWithFormat:@"%@/%@", baseUrl, method];
@@ -363,7 +363,7 @@ constructingBodyWithBlock:^(id<AFMultipartFormData> _Nonnull formData) {
@kWeakify(self);
[manager DELETE:method parameters:params headers:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject];
#if 0
#if DEBUG
NSLog(@"\n%@\n", [baseModel toJSONString]);
#else
#endif

View File

@@ -4235,3 +4235,12 @@ ineHeadView12" = "الحمل";
"20.20.62_text_6" = "الميكروفون مشغول. يُرجى المحاولة لاحقًا.";
"20.20.62_text_7" = "ليس لديك إذن لدعوة المستخدم إلى الميكروفون.";
"20.20.62_text_8" = "فشل إرسال الدعوة. يُرجى التحقق من الشبكة.";
"20.20.62_text_9" = "Turn effects on/off";
"20.20.62_text_9.1" = "Turn effects on";
"20.20.62_text_9.2" = "Turn effects off";
"20.20.62_text_10" = "Gift effects";
"20.20.62_text_11" = "Global gift screen";
"20.20.62_text_12" = "Global game screen";
"20.20.62_text_13" = "Turbo mode";
"20.20.62_text_14" = "我的特效";

View File

@@ -4022,3 +4022,12 @@
"20.20.62_text_6" = "The mic is occupied. Please try again later.";
"20.20.62_text_7" = "You do not have permission to invite the user to the mic.";
"20.20.62_text_8" = "The invitation failed to be sent. Please check the network.";
"20.20.62_text_9" = "Turn effects on/off";
"20.20.62_text_9.1" = "Turn effects on";
"20.20.62_text_9.2" = "Turn effects off";
"20.20.62_text_10" = "Gift effects";
"20.20.62_text_11" = "Global gift screen";
"20.20.62_text_12" = "Global game screen";
"20.20.62_text_13" = "Turbo mode";
"20.20.62_text_14" = "我的特效";

View File

@@ -3315,3 +3315,12 @@
"20.20.62_text_6" = "O microfone está ocupado. Tente novamente mais tarde.";
"20.20.62_text_7" = "Você não tem permissão para convidar o usuário para o microfone.";
"20.20.62_text_8" = "O convite não foi enviado. Verifique a rede.";
"20.20.62_text_9" = "Turn effects on/off";
"20.20.62_text_9.1" = "Turn effects on";
"20.20.62_text_9.2" = "Turn effects off";
"20.20.62_text_10" = "Gift effects";
"20.20.62_text_11" = "Global gift screen";
"20.20.62_text_12" = "Global game screen";
"20.20.62_text_13" = "Turbo mode";
"20.20.62_text_14" = "我的特效";

View File

@@ -3816,3 +3816,12 @@
"20.20.62_text_6" = "Mikrofon meşgul. Lütfen daha sonra tekrar deneyin.";
"20.20.62_text_7" = "Kullanıcıyı mikrofona davet etme izniniz yok.";
"20.20.62_text_8" = "Davet gönderilemedi. Lütfen ağı kontrol edin.";
"20.20.62_text_9" = "Turn effects on/off";
"20.20.62_text_9.1" = "Turn effects on";
"20.20.62_text_9.2" = "Turn effects off";
"20.20.62_text_10" = "Gift effects";
"20.20.62_text_11" = "Global gift screen";
"20.20.62_text_12" = "Global game screen";
"20.20.62_text_13" = "Turbo mode";
"20.20.62_text_14" = "我的特效";

View File

@@ -3686,3 +3686,13 @@
"20.20.62_text_6" = "麥克風已被佔用,請稍後再試。";
"20.20.62_text_7" = "您無權邀請該使用者加入麥克風。";
"20.20.62_text_8" = "邀請發送失敗,請檢查網路。";
"20.20.62_text_9" = "Turn effects on/off";
"20.20.62_text_9.1" = "Turbo mode on";
"20.20.62_text_9.2" = "Turbo mode off";
"20.20.62_text_10" = "Gift effects";
"20.20.62_text_11" = "Global gift screen";
"20.20.62_text_12" = "Global game screen";
"20.20.62_text_13" = "Turbo mode";
"20.20.62_text_14" = "我的特效";