新增 TurboModeStateManager 的功能,支持 CP 麦位开关状态管理,优化房间中各个视图对 Turbo 模式的集成。更新相关视图控制器以使用 TurboModeStateManager 获取和设置开关状态,提升代码可维护性和用户体验。同时,新增 CP 麦位相关的本地化字符串,确保多语言支持。
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#import "RtcManager.h"
|
||||
#import "XPRoomMiniManager.h"
|
||||
#import "TTPopup.h"
|
||||
#import "TurboModeStateManager.h"
|
||||
#import "Api+ArrangeMic.h"
|
||||
#import "Api+Room.h"
|
||||
#import "DESEncrypt.h"
|
||||
@@ -1075,6 +1076,9 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
// 🔧 新增:stage view类型变化时调用CP相关API
|
||||
NSMutableDictionary<NSString *,MicroQueueModel *> *currentQueue = [self.stageView getMicroQueue];
|
||||
[self callMicCpListByUidListOnMicChangeWithQueue:currentQueue];
|
||||
|
||||
// 🔧 新增:检查19 mic房间中央位置(position 6)用户资格
|
||||
[self checkCentralPositionUserQualification:currentQueue];
|
||||
|
||||
[self addExitGameButton];
|
||||
|
||||
@@ -1197,7 +1201,11 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
return;
|
||||
}
|
||||
_roomInfo = roomInfo;
|
||||
[[LuckyPackageLogicManager sharedInstance] setRoomUid:@(roomInfo.uid).stringValue];
|
||||
|
||||
NSString *roomId = @(self.roomInfo.roomId).stringValue;
|
||||
NSLog(@"🎮 设置房间ID: %@", roomId);
|
||||
[[TurboModeStateManager sharedManager] setCurrentRoomId:roomId];
|
||||
[[LuckyPackageLogicManager sharedInstance] setRoomUid:roomId];
|
||||
[[RoomResourceManager sharedManager] updateCurrentSkinID:roomInfo.usedMicSkinId
|
||||
effectID:roomInfo.usedMicEffectId];
|
||||
|
||||
@@ -1739,7 +1747,7 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
|
||||
[self.stageView onRoomEntered];
|
||||
[self.functionView onRoomEntered];
|
||||
|
||||
|
||||
// 🔧 新增:初始化当前用户的麦位状态
|
||||
[self initializeCurrentUserMicStatus];
|
||||
|
||||
@@ -4303,4 +4311,63 @@ XPCandyTreeInsufficientBalanceViewDelegate>
|
||||
}
|
||||
}
|
||||
|
||||
/// 检查19 mic房间中央位置(position 6)用户资格
|
||||
- (void)checkCentralPositionUserQualification:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
||||
// 只检查19 mic房间
|
||||
if (self.roomInfo.type != RoomType_19Mic) {
|
||||
return;
|
||||
}
|
||||
|
||||
NSLog(@"🔧 检查19 mic房间中央位置用户资格");
|
||||
|
||||
// 查找中央位置(position 6)的用户
|
||||
MicroQueueModel *centralMicModel = nil;
|
||||
for (NSString *positionKey in queue.allKeys) {
|
||||
MicroQueueModel *micModel = queue[positionKey];
|
||||
if (micModel.microState.position == 6) {
|
||||
centralMicModel = micModel;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果中央位置有用户,检查其资格
|
||||
if (centralMicModel && centralMicModel.userInfo) {
|
||||
NSString *userId = [NSString stringWithFormat:@"%ld", (long)centralMicModel.userInfo.uid];
|
||||
NSLog(@"🔧 中央位置用户:%@,检查资格", userId);
|
||||
|
||||
// 调用Boss位置资格检查API
|
||||
[Api requestBossMicUp:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSLog(@"✅ 中央位置用户资格检查通过:%@", userId);
|
||||
} else {
|
||||
NSLog(@"❌ 中央位置用户资格检查失败:%@,错误:%@", userId, msg);
|
||||
// 不满足条件的用户需要下mic
|
||||
[self forceDownMicForUser:userId atPosition:6];
|
||||
}
|
||||
} roomUid:@(self.roomInfo.uid).stringValue uid:userId];
|
||||
} else {
|
||||
NSLog(@"🔧 中央位置无用户,无需检查");
|
||||
}
|
||||
}
|
||||
|
||||
/// 强制用户下mic
|
||||
- (void)forceDownMicForUser:(NSString *)userId atPosition:(NSInteger)position {
|
||||
NSLog(@"🔧 强制用户下mic:%@,位置:%ld", userId, (long)position);
|
||||
|
||||
// 使用 NIM 的 API 强制下mic
|
||||
NIMChatroomQueueRemoveRequest *request = [[NIMChatroomQueueRemoveRequest alloc] init];
|
||||
request.key = [NSString stringWithFormat:@"%ld", (long)position];
|
||||
request.roomId = @(self.roomInfo.uid).stringValue;
|
||||
|
||||
[[NIMSDK sharedSDK].chatroomManager removeChatroomQueueObject:request completion:^(NSError * _Nullable error, NSDictionary<NSString *,NSString *> * _Nullable element) {
|
||||
if (error) {
|
||||
NSLog(@"❌ 强制下mic失败:%@,错误:%@", userId, error.localizedDescription);
|
||||
[XNDJTDDLoadingTool showErrorWithMessage:@"强制下mic失败"];
|
||||
} else {
|
||||
NSLog(@"✅ 强制下mic成功:%@", userId);
|
||||
[XNDJTDDLoadingTool showSuccessWithMessage:@"中央位置需要满足贡献值要求,已自动下mic"];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user