房间PK终于完工了

This commit is contained in:
fengshuo
2022-04-01 14:24:58 +08:00
parent 77646e1e76
commit 958f8e8aca
27 changed files with 384 additions and 58 deletions

View File

@@ -140,7 +140,7 @@
info.roomTitle = roomInfo.title;
info.micQueue = [self.delegate getMicroQueue];
info.isManager = (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager);
info.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? ArrangeMicType_Dating : ArrangeMicType_Normal;
info.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? ArrangeMicType_Dating : roomInfo.roomModeType == RoomModeType_Open_PK_Mode ? ArrangeMicType_Room_PK : ArrangeMicType_Normal;
XPArrangeMicViewController * arrangeMicVC = [[XPArrangeMicViewController alloc] initWithInfo:info];
[self.delegate.getCurrentNav presentViewController:arrangeMicVC animated:YES completion:nil];
}];
@@ -281,14 +281,14 @@
}
self.arrangeMicButton.hidden = roomInfo.roomModeType != RoomModeType_Open_Micro_Mode;
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
if (roomInfo.roomModeType == RoomModeType_Open_Blind || roomInfo.roomModeType == RoomModeType_Open_PK_Mode || roomInfo.roomModeType == RoomModeType_Open_Micro_Mode) {
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
if (member.type == NIMTeamMemberTypeOwner || member.type == NIMTeamMemberTypeManager) {
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
self.arrangeMicButton.hidden = NO;
return;
}
@@ -302,8 +302,8 @@
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
if (attachment.first == CustomMessageType_Arrange_Mic) {
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Arrange_Mic_Empty) {
if (attachment.first == CustomMessageType_Arrange_Mic || attachment.first == CustomMessageType_Room_PK) {
if (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Arrange_Mic_Empty || attachment.second == Custom_Message_Sub_Room_PK_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty) {
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
@@ -313,7 +313,7 @@
member = members.firstObject;
}
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
self.arrangeMicButton.selected = attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty;
self.arrangeMicButton.selected = (attachment.second == Custom_Message_Sub_Arrange_Mic_Non_Empty || attachment.second == Custom_Message_Sub_Room_PK_Non_Empty);
};
}];
}
@@ -327,7 +327,7 @@
switch (content.eventType) {
case NIMChatroomEventTypeAddManager:
{
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) {
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind || self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
for (NIMChatroomNotificationMember * member in content.targets) {
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
self.arrangeMicButton.hidden = NO;
@@ -339,7 +339,7 @@
break;
case NIMChatroomEventTypeRemoveManager:
{
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) {
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind || self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
for (NIMChatroomNotificationMember * member in content.targets) {
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
self.arrangeMicButton.hidden = YES;