相亲动画

This commit is contained in:
fengshuo
2022-01-05 21:48:21 +08:00
parent 167b4934ce
commit a24b1d7dce
11 changed files with 628 additions and 10 deletions

View File

@@ -24,6 +24,7 @@
#import "UserInfoModel.h"
#import "MicroStateModel.h"
#import "RoomInfoModel.h"
#import "DatingInfoModel.h"
#import "NetImageView.h"
@@ -74,6 +75,8 @@
return [self createRoomInfoUpdateAttribute:attachment];
} else if(first == CustomMessageType_Collection_Room) {
return [self createCollectRoomAttribute:attachment];
} else if(first == CustomMessageType_RoomPlay_Dating) {
return [self createRoomDatingAttribute:attachment];
}
return nil;
}
@@ -108,7 +111,7 @@
/// tips
/// @param message
- (NSAttributedString*)makeTipsAttribute:(NIMMessage *)message {
return [self createTextAttribute:message.text color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont];
return [self createTextAttribute:message.text color:UIColorFromRGB(0xFE5D7F) font:kRoomMessageDefalutFont];
}
///
@@ -142,9 +145,18 @@
return attribute;
}
break;
case NIMChatroomEventTypeInfoUpdated:{
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if (self.hostDelegate.getRoomInfo.isOpenRoomDating) {
[attribute appendAttributedString:[self createTextAttribute:@"相亲玩法已开启,请点击主持人麦位选择主持人" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
return attribute;
}
}
break;
default:
return nil;
}
return nil;
}
#pragma mark -
@@ -188,6 +200,43 @@
return nil;
}
#pragma mark -
- (NSAttributedString *)createRoomDatingAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
if(attachment.second == Custom_Message_Sub_Room_Play_Dating_Pick_Heart) {
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
NSString * targetGender = datingModel.targetGender == GenderType_Male ? @"男" : @"女";
NSString * pickString = [NSString stringWithFormat:@"%d号%@嘉宾:", (datingModel.targetPosition + 1), targetGender];
[attribute appendAttributedString:[self createTextAttribute:@"本轮你选择了" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createTextAttribute:pickString color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString * targetNick = datingModel.targetNickname ? datingModel.targetNickname : @"";
[attribute appendAttributedString:[self createNickAtrribute:targetNick uid:datingModel.targetUid]];
NSString * heartContent = @"作为你的心动对象";
[attribute appendAttributedString:[self createTextAttribute:heartContent color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
} else if(attachment.second == Custom_Message_Sub_Room_Play_Dating_Result_Mutual) {///
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
[attribute appendAttributedString:[self createTextAttribute:@"恭喜" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString * nick = datingModel.nickname ? datingModel.nickname : @"";
[attribute appendAttributedString:[self createNickAtrribute:nick uid:datingModel.uid]];
[attribute appendAttributedString:[self createTextAttribute:@"和" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString * targetNick = datingModel.targetNickname ? datingModel.targetNickname : @"";
[attribute appendAttributedString:[self createNickAtrribute:targetNick uid:datingModel.targetUid]];
[attribute appendAttributedString:[self createTextAttribute:@"牵手成功,让我们见证他们幸福的开端" color:UIColorFromRGB(0xF84C95) font:kRoomMessageDefalutFont]];
} else if (attachment.second == Custom_Message_Sub_Room_Play_Dating_Result_Not_Mutual) {///
DatingInfoModel * datingModel = [DatingInfoModel modelWithDictionary:attachment.data];
NSString * nick = datingModel.nickname ? datingModel.nickname : @"";
[attribute appendAttributedString:[self createNickAtrribute:nick uid:datingModel.uid]];
if (datingModel.hasSelectUser) {//
[attribute appendAttributedString:[self createTextAttribute:@"的心动对象是" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
NSString * targetNick = datingModel.targetNickname ? datingModel.targetNickname : @"";
[attribute appendAttributedString:[self createNickAtrribute:targetNick uid:datingModel.targetUid]];
} else {///
[attribute appendAttributedString:[self createTextAttribute:@"未选择心动对象" color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
}
}
return attribute;
}
#pragma mark -
- (NSAttributedString *)createArrangeMicAttribute:(AttachmentModel *)attachment {
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];