房间PK根据送礼物的人数开始的话 显示异常的问题

This commit is contained in:
fengshuo
2022-05-31 17:31:13 +08:00
parent c050ece645
commit 3a2642d6d0
5 changed files with 31 additions and 27 deletions

View File

@@ -322,24 +322,22 @@
make.top.mas_equalTo(self).offset(35 + (58 + 5 + 6 + 12) + 38 + (55 + 10 + 12 + 5+16) * 2 + 15 * 2 + kNavigationHeight + 5);
}];
}
if (isEnter) {
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
NSString * uid = [AccountInfoStorage instance].getUid;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = roomId;
request.userIds = @[uid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
self.roompkPanelView.isManager = YES;
}else {
self.roompkPanelView.isManager = NO;
}
[self.roompkPanelView enterRoomGetRoomPKDetailInfo];
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
NSString * uid = [AccountInfoStorage instance].getUid;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = roomId;
request.userIds = @[uid];
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
if (error == nil) {
NIMChatroomMember * member = members.firstObject;
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
self.roompkPanelView.isManager = YES;
}else {
self.roompkPanelView.isManager = NO;
}
}];
}
[self.roompkPanelView enterRoomGetRoomPKDetailInfo];
}
}];
} else {
if (self.roompkPanelView.superview) {
[self.roompkPanelView removeFromSuperview];

View File

@@ -317,7 +317,7 @@
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
}
if (team.score > 0) {
if (team.protector > 0) {
[attribute appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@"\n"]];
NSString * teamStr = [NSString stringWithFormat:@"蓝队守护者:%@ \n 蓝队守护值: %@ \n 红队守护者: %@ \n 红队守护值: %@", blueTeam.protector.nick.length > 0 ? blueTeam.protector.nick : @"", [[NSNumber numberWithLongLong:blueTeam.protecScore] stringValue], redTeam.protector.nick.length > 0 ? redTeam.protector.nick : @"", [[NSNumber numberWithLongLong:redTeam.protecScore] stringValue]];
[attribute appendAttributedString:[self createTextAttribute:teamStr color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -386,7 +386,7 @@
- (void)showRoomPKResult:(NSDictionary *)dic {
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:dic];
if (pkInfo.pkStatus == RoomPKStatusType_End) {
if (pkInfo.pkStatus == RoomPKStatusType_End || pkInfo.pkStatus == RoomPKStatusType_ReStart) {
XPRoomPKResultView * result = [[XPRoomPKResultView alloc] init];
result.roomPKResultInfoModel = pkInfo;
[TTPopup popupView:result style:TTPopupStyleAlert];

View File

@@ -144,6 +144,7 @@
}
[self handleRoomPKInfoChangeState];
} else if(attachment.second == Custom_Message_Sub_Room_PK_Mode_Close) {
[XCHUDTool showSuccessWithMessage:@"关闭PK模式成功"];
[self stopRoomPKCountDown];
[self clearRoomPKTeamData];
[self removeFromSuperview];
@@ -488,20 +489,25 @@
- (void)canculeRoomPKSendGiftNumPerson:(NSArray *)sendGiftUses {
for (NSString * uid in sendGiftUses) {
NSString * userId = uid;
if ([userId isKindOfClass:[NSNumber class]]) {
userId = ((NSNumber *)userId).stringValue;
}
for (int i = 0; i < self.redChooseArray.count; i++) {
RoomPKChooseUserModel * redUserInfo = [self.redChooseArray objectAtIndex:i];
if (uid.integerValue == redUserInfo.uid.integerValue) {
[self.redTeamGiftPersonDic addObject:uid];
if (userId.integerValue == redUserInfo.uid.integerValue) {
[self.redTeamGiftPersonDic addObject:userId];
}
}
for (int i = 0; i < self.blueChooseArray.count; i++) {
RoomPKChooseUserModel * redUserInfo = [self.blueChooseArray objectAtIndex:i];
if (uid.integerValue == redUserInfo.uid.integerValue) {
[self.blueTeamGiftPersonDic addObject:uid];
if (userId.integerValue == redUserInfo.uid.integerValue) {
[self.blueTeamGiftPersonDic addObject:userId];
}
}
}
NSLog(@"红队:%@ 蓝队:%@", self.redTeamGiftPersonDic, self.blueTeamGiftPersonDic);
[self configRedTeamScore:self.redTeamGiftPersonDic.count blueTeamScore:self.blueTeamGiftPersonDic.count];
}
@@ -808,12 +814,13 @@
[Api createRoomPK:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomPKInfoModel * newRoomPKInfo = [RoomPKInfoModel modelWithDictionary:data.data];
self.roomPKInfo = newRoomPKInfo;
NSString * teamJsonStr = [self roomPKTeamJsonString];
///PK
[Api begainRoomPK:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
RoomPKDetailInfoModel * detailPKInfo = [RoomPKDetailInfoModel modelWithDictionary:data.data];
self.roomPKInfo = detailPKInfo.roomPK;
RoomPKInfoModel * roomPKInfo = [RoomPKInfoModel modelWithDictionary:data.data];
self.roomPKInfo = roomPKInfo;
} else {
[XCHUDTool showErrorWithMessage:msg];
}

View File

@@ -304,7 +304,6 @@
}
- (void)closeRoomPKSuccess {
[self showSuccessToast:@"关闭PK模式成功"];
[self.navigationController popViewControllerAnimated:YES];
}

View File

@@ -31,7 +31,7 @@
} else {
image = [UIImage imageNamed:@"room_position_lock"];
}
if (micState.position == 7) {
if (micState.position == 7 && self.getRoomInfo.roomModeType != RoomModeType_Open_PK_Mode) {
image = [UIImage imageNamed:@"room_position_boss"];
}
CGSize scaledToSize = CGSizeMake(self.frame.size.width, self.frame.size.width);