From a79bf667cc291f7d34bb4b1734b2542f77aa3295 Mon Sep 17 00:00:00 2001 From: edwinQQQ Date: Thu, 9 Jan 2025 18:05:02 +0800 Subject: [PATCH] fix: bug fix --- .../Tool/XPRoomMessageParser.m | 21 ++++++++++++------- .../View/RoomMode/RoomModeViewController.m | 21 ++++++++----------- .../View/UserRoomCardViewController.m | 4 ++-- 3 files changed, 25 insertions(+), 21 deletions(-) diff --git a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m index ceabfc13..3a3e2c5c 100644 --- a/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m +++ b/YuMi/Modules/YMRoom/View/MessageContainerView/Tool/XPRoomMessageParser.m @@ -1074,18 +1074,25 @@ - (XPMessageInfoModel *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info messageInfo:(XPMessageInfoModel *)messageInfo{ NSString * content= @""; + NSString * targetName = [NSString isEmpty:info.targetNick] ? @"" : info.targetNick; + NSString * handleName = [NSString isEmpty:info.handleNick] ? @"" : info.handleNick; if (attachment.second == Custom_Message_Sub_Kick_BeKicked || attachment.second == Custom_Message_Sub_Hall_Super_Admin_Kick_Manager_Out_Room) { - content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser93"),info.targetNick,info.handleNick]; + content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser93"),targetName,handleName]; } else if(attachment.second == Custom_Message_Sub_Kick_BlackList) { - content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser94"),info.targetNick,info.handleNick]; + content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser94"),targetName,handleName]; } else if(attachment.second == Custom_Message_Sub_Queue_Kick) { - content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser95"),info.targetNick,info.handleNick]; + content = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser95"),targetName,handleName]; } NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:content attributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageDefaultTextColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]}]; - [attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:info.targetNick]]; - [attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:info.handleNick]]; - [self attributeAddHihtLight:attribute range:[content rangeOfString:info.targetNick] uid:info.targetUid]; - [self attributeAddHihtLight:attribute range:[content rangeOfString:info.handleNick] uid:info.handleUid]; + if (![NSString isEmpty:targetName]) { + [attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:targetName]]; + [self attributeAddHihtLight:attribute range:[content rangeOfString:targetName] uid:info.targetUid]; + } + if (![NSString isEmpty:handleName]) { + [attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor],NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont]} range:[content rangeOfString:handleName]]; + [self attributeAddHihtLight:attribute range:[content rangeOfString:handleName] uid:info.handleUid]; + } + messageInfo.content = attribute; return messageInfo; } diff --git a/YuMi/Modules/YMRoom/View/RoomMode/RoomModeViewController.m b/YuMi/Modules/YMRoom/View/RoomMode/RoomModeViewController.m index 0ce3d91c..204de46e 100644 --- a/YuMi/Modules/YMRoom/View/RoomMode/RoomModeViewController.m +++ b/YuMi/Modules/YMRoom/View/RoomMode/RoomModeViewController.m @@ -248,30 +248,27 @@ - (void)setRoomInfo:(RoomInfoModel *)roomInfo { _roomInfo = roomInfo; self.avatarImage.imageUrl = roomInfo.avatar; - self.nameLabel.text = roomInfo.nick; + self.nameLabel.text = roomInfo.title; } - (void)setLevelInfo:(RoomLevelInfoModel *)LevelInfo { _LevelInfo = LevelInfo; self.levelImage.imageUrl = LevelInfo.currentLevelIcon; self.expProgressView.progress = (LevelInfo.roomVal - LevelInfo.currentLevelExp) * 100.0 / (LevelInfo.nextLevelExp - LevelInfo.currentLevel) / 100.0; - - self.valueLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_6"), @(LevelInfo.roomVal)]; - self.nextLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.nextLevel)]; - self.currentLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.currentLevel)]; - self.expToNextLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_8"), @(LevelInfo.nextLevelExp - LevelInfo.roomVal)]; - self.adminLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.33_text_7"), @(LevelInfo.currentManagerNum), @(LevelInfo.managerLimitNum)]; - + if (LevelInfo.nextLevel == 0) { self.nextLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.currentLevel)]; self.currentLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.currentLevel - 1)]; self.expProgressView.progress = 1; self.expToNextLabel.hidden = YES; + } else { + self.expToNextLabel.hidden = NO; + self.nextLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.nextLevel)]; + self.currentLevelLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_9"), @(LevelInfo.currentLevel)]; } - -#if DEBUG - self.expProgressView.progress = 0.3; -#endif + self.valueLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_6"), @(LevelInfo.roomVal)]; + self.adminLabel.text = [NSString stringWithFormat:YMLocalizedString(@"1.0.33_text_7"), @(LevelInfo.currentManagerNum), @(LevelInfo.managerLimitNum)]; + self.expToNextLabel.text = [NSString stringWithFormat:@"%@%@", YMLocalizedString(@"1.0.33_text_8"), @(LevelInfo.nextLevelExp - LevelInfo.roomVal)]; } - (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { diff --git a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m index a0fed24f..bc7dd9f1 100644 --- a/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m +++ b/YuMi/Modules/YMRoom/View/UserCard/View/UserRoomCardViewController.m @@ -1349,13 +1349,13 @@ } else { // self.operaStackView.hidden = YES; self.upMicFlag = YES; - int micCount = 9; + NSInteger micCount = 9; switch (self.cardInfo.roomInfo.type) { case RoomType_Anchor: micCount = 4; break; case RoomType_MiniGame: - micCount = 6; + micCount = self.cardInfo.roomInfo.mgMicNum; break; case RoomType_Game: micCount = 9;