糖果树公屏显示

This commit is contained in:
fengshuo
2021-12-10 21:20:34 +08:00
parent 2a1e90dbe5
commit ae29a3a80f
7 changed files with 110 additions and 2 deletions

View File

@@ -64,6 +64,8 @@
} else if(first == CustomMessageType_Kick_User || first == CustomMessageType_Queue) {
XPKickUserModel * kickModel = [XPKickUserModel modelWithJSON:attachment.data];
return [self createKickUserAttribute:attachment info:kickModel];
} else if(first == CustomMessageType_Candy_Tree ) {//
return [self createCandyTreeHighLevelAttribute:attachment];
}
return nil;
}
@@ -126,6 +128,22 @@
return nil;
}
#pragma mark -
- (NSAttributedString *)createCandyTreeHighLevelAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
//action
[attribute appendAttributedString:[self createTextAttribute:@"厉害了 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
NSInteger uid = 0;
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
uid = ((NSNumber *)attachment.data[@"uid"]).integerValue;
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
uid = ((NSString *)attachment.data[@"uid"]).integerValue;
}
[attribute appendAttributedString:[self createNickAtrribute:attachment.data[@"nick"] uid:uid]];
[attribute appendAttributedString:[self createTextAttribute:@"摘下糖果获得" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:attachment.data[@"prizeName"] color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
return attribute;
}
#pragma mark - //
- (NSAttributedString *)createKickUserAttribute:(AttachmentModel *)attachment info:(XPKickUserModel *)info {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];