星级厨房飘屏

This commit is contained in:
liyuhua
2023-08-31 17:08:59 +08:00
parent 9ae3f13cee
commit 42f0e00db2
4 changed files with 24 additions and 26 deletions

View File

@@ -410,32 +410,19 @@
//}
- (XPMessageInfoModel *)createStarredKitchenAttribute:(AttachmentModel *)attachment messageInfo:(XPMessageInfoModel *)messageInfo{
XPRoomStarKitchenModel * giftInfo = [XPRoomStarKitchenModel modelWithDictionary:attachment.data];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
CGFloat fontSize = 13;
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser14") color:[UIColor whiteColor] font:fontSize]];
NSString * nick = giftInfo.nick;
if (nick.length > 6) {
nick = [nick substringToIndex:6];
}
[attribute appendAttributedString:[self createTextAttribute:nick color:[DJDKMIMOMColor colorWithHexString:@"#FEF23E"] font:fontSize]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser112") color:[UIColor whiteColor] font:fontSize]];
[attribute appendAttributedString:[self createTextAttribute:[NSString stringWithFormat:@"%@", giftInfo.diamonds] color:[DJDKMIMOMColor colorWithHexString:@"#00EAFF"] font:fontSize]];
[attribute appendAttributedString:[self createTextAttribute:YMLocalizedString(@"XPRoomMessageParser113") color:[UIColor whiteColor] font:fontSize]];
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
paragraphStyle.lineBreakMode = NSLineBreakByCharWrapping;
paragraphStyle.lineSpacing = 4.0f;//
paragraphStyle.baseWritingDirection = NSWritingDirectionLeftToRight;
[attribute addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, attribute.length)];
@kWeakify(self);
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
XPRoomStarKitchenModel *starModel = [XPRoomStarKitchenModel modelWithDictionary:attachment.data];
NSString *title = [NSString stringWithFormat:YMLocalizedString(@"XPRoomMessageParser1033333"),starModel.nick,starModel.itemMultiple,starModel.diamonds];
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:kRoomMessageDefalutFont],NSForegroundColorAttributeName:[DJDKMIMOMColor messageDefaultTextColor]}];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageNickColor]} range:[title rangeOfString:starModel.nick]];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor]} range:[title rangeOfString:[NSString stringWithFormat:@" %@",starModel.itemMultiple]]];
[attribute addAttributes:@{NSForegroundColorAttributeName:[DJDKMIMOMColor messageTextColor]} range:[title rangeOfString:[NSString stringWithFormat:@" %@",starModel.diamonds]]];
@kWeakify(self)
[attribute yy_setTextHighlightRange:[title rangeOfString:starModel.nick] color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
@kStrongify(self);
if (giftInfo &&giftInfo.needLevel < self.hostDelegate.getUserInfo.userLevelVo.experLevelSeq && giftInfo.skipUrl.length > 0) {
XPWebViewController * webVC = [[XPWebViewController alloc] init];
webVC.url = giftInfo.skipUrl;
[[XCCurrentVCStackManager shareManager].getCurrentVC.navigationController pushViewController:webVC animated:YES];
}
if (starModel.uid.integerValue <= 0) {return;}
[self showUserCard:starModel.uid.integerValue];
}];
messageInfo.content = attribute;
return messageInfo;
}

View File

@@ -1344,6 +1344,16 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
if (broadcastMessage.content) {
NSDictionary *msgDictionary = [broadcastMessage.content toJSONObject];
AttachmentModel *attachment = [AttachmentModel modelWithJSON:msgDictionary[@"body"]];
BOOL isHave = NO;
if(attachment.first == CustomMessageType_Graffiti_Star_Kitchen && attachment.second == Custom_Message_Sub_Star_Kitchen_FullScreen){
isHave = YES;
}else if(attachment.first == CustomMessageType_Look_Love && attachment.second == Custom_Message_Sub_Look_Love_InRoom_NeedAllMicSend){
}else if (attachment.first == CustomMessageType_Treasure_Fairy && (attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L4 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Draw_Gift_L5 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L1 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L2 || attachment.second == Custom_Message_Sub_Treasure_Fairy_Convert_L3)) { //
}
if(isHave == NO)return;
attachment.isBroadcast = YES;
NIMMessage *message = [NIMMessage new];
NIMCustomObject *object = [NIMCustomObject new];
@@ -1351,6 +1361,7 @@ NSString * const kHadQuitOtherRoomKey = @"kHadQuitOtherRoomKey";//是否退出
message.messageObject = object;
[self.messageContainerView handleNIMTextMessage:message];
}
}
//

View File

@@ -47,7 +47,7 @@
"LoginPresenter0" = "登录取消";
"LoginPresenter1" = "登录失败,请重试";
"XPRoomStarKitchenBannerView0"="恭喜%@在星级厨房抽中%@倍奖励,获得 %@钻石!";
"XPRoomMessageParser103"="恭喜%@在星级厨房抽中 %@倍奖励,获得 %@钻石!";
"XPRoomMessageParser1033333"="恭喜%@在星级厨房抽中 %@倍奖励,获得 %@钻石!";
///XPShareView.m
"XPShareView0" = "拷贝成功";
"XPShareView1" = "来玩奥";

View File

@@ -47,7 +47,7 @@
"LoginPresenter0" = "登錄取消";
"LoginPresenter1" = "登錄失敗,請重試";
"XPRoomStarKitchenBannerView0"="恭喜%@在星級廚房抽中%@倍獎勵,獲得 %@鉆石!";
"XPRoomMessageParser103"="恭喜%@在星級廚房抽中 %@倍獎勵,獲得 %@鉆石!";
"XPRoomMessageParser1033333"="恭喜%@在星級廚房抽中 %@倍獎勵,獲得 %@鉆石!";
///XPShareView.m
"XPShareView0" = "拷貝成功";
"XPShareView1" = "來玩奧";