驾驶座驾进房
This commit is contained in:
@@ -171,6 +171,7 @@
|
||||
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C75276AEB5100858D6D /* NameplateModel.m */; };
|
||||
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */; };
|
||||
E82D5C7D276B343300858D6D /* YYAnimatedImageView+ImageShow.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */; };
|
||||
E82D5C80276B635600858D6D /* XPUserEnterRoomExtModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C7F276B635600858D6D /* XPUserEnterRoomExtModel.m */; };
|
||||
E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
|
||||
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
|
||||
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.m */; };
|
||||
@@ -682,6 +683,8 @@
|
||||
E82D5C79276B25D100858D6D /* SpriteSheetImageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpriteSheetImageManager.m; sourceTree = "<group>"; };
|
||||
E82D5C7B276B343300858D6D /* YYAnimatedImageView+ImageShow.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ImageShow.h"; sourceTree = "<group>"; };
|
||||
E82D5C7C276B343300858D6D /* YYAnimatedImageView+ImageShow.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ImageShow.m"; sourceTree = "<group>"; };
|
||||
E82D5C7E276B635600858D6D /* XPUserEnterRoomExtModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPUserEnterRoomExtModel.h; sourceTree = "<group>"; };
|
||||
E82D5C7F276B635600858D6D /* XPUserEnterRoomExtModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPUserEnterRoomExtModel.m; sourceTree = "<group>"; };
|
||||
E82EE0F6272FDDFA00D15DC1 /* UserPrivacyView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = UserPrivacyView.h; sourceTree = "<group>"; };
|
||||
E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserPrivacyView.m; sourceTree = "<group>"; };
|
||||
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
|
||||
@@ -2311,6 +2314,8 @@
|
||||
children = (
|
||||
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */,
|
||||
E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */,
|
||||
E82D5C7E276B635600858D6D /* XPUserEnterRoomExtModel.h */,
|
||||
E82D5C7F276B635600858D6D /* XPUserEnterRoomExtModel.m */,
|
||||
);
|
||||
path = CustomMessage;
|
||||
sourceTree = "<group>";
|
||||
@@ -3351,6 +3356,7 @@
|
||||
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
|
||||
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,
|
||||
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */,
|
||||
E82D5C80276B635600858D6D /* XPUserEnterRoomExtModel.m in Sources */,
|
||||
E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */,
|
||||
18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */,
|
||||
E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */,
|
||||
|
@@ -58,6 +58,14 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic, copy) NSString *nameplateWord;
|
||||
///如果在房间有直播中字段
|
||||
@property(nonatomic, copy) NSString * roomUid;
|
||||
///用户信息中的 座驾 并不需要CarModel 映射一下吧
|
||||
@property (nonatomic,copy) NSString *carEffect;
|
||||
///用户信息中的 座驾昵称 并不需要CarModel 映射一下吧
|
||||
@property (nonatomic,copy) NSString *carName;
|
||||
///用户信息中的 头饰的动画 并不需要HeadwearModel 映射一下吧
|
||||
@property (nonatomic,copy) NSString *headwearEffect;
|
||||
///用户信息中的 头饰的动画 如果没有的话 就用这个 并不需要HeadwearModel 映射一下吧
|
||||
@property (nonatomic,copy) NSString *headwearPic;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -15,4 +15,13 @@
|
||||
};
|
||||
}
|
||||
|
||||
///如果一个模型中需要字段映射的话 比如id -> ID name -> other.name
|
||||
+ (NSDictionary *)replacedKeyFromPropertyName {
|
||||
return @{@"carEffect": @"carport.effect",
|
||||
@"headwearEffect" : @"userHeadwear.effect",
|
||||
@"headwearPic" : @"userHeadwear.pic",
|
||||
@"carName": @"carport.name"
|
||||
};
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -20,6 +20,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
|
||||
CustomMessageType_Queue = 8,
|
||||
///全麦送
|
||||
CustomMessageType_AllMicroSend = 12,
|
||||
///座驾进房动画
|
||||
CustomMessageType_Car_Notify = 15,
|
||||
///踢出房间
|
||||
CustomMessageType_Kick_User = 18,
|
||||
///糖果树
|
||||
@@ -75,6 +77,11 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubAllMicroSend) {
|
||||
Custom_Message_Sub_AllMicroLuckySend = 125,
|
||||
};
|
||||
|
||||
///first == CustomMessageType_Car_Notify
|
||||
typedef NS_ENUM(NSUInteger, CustomMessageSubCar) {
|
||||
Custom_Message_Sub_Car_EnterRoom = 159, //进房动画
|
||||
};
|
||||
|
||||
///first = CustomMessageType_Kick_User
|
||||
typedef NS_ENUM(NSUInteger, CustomNotificationSubKick) {
|
||||
///拉黑
|
||||
|
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// XPUserEnterRoomExtModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/16.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPUserEnterRoomExtModel : NSObject
|
||||
///座驾名称
|
||||
@property (nonatomic,copy) NSString *carName;
|
||||
///魅力等级
|
||||
@property (nonatomic,copy) NSString *charmUrl;
|
||||
@property (nonatomic,assign) NSInteger erbanNo;
|
||||
///等级编号
|
||||
@property (nonatomic,assign) NSInteger experLevelSeq;
|
||||
///等级
|
||||
@property (nonatomic,copy) NSString *experUrl;
|
||||
///跟随的
|
||||
@property (nonatomic,copy) NSString *fromNick;
|
||||
@property (nonatomic,copy) NSString *fromType;
|
||||
@property (nonatomic,copy) NSString *fromUid;
|
||||
///名牌的
|
||||
@property (nonatomic,copy) NSString *inRoomNameplatePic;
|
||||
///铭牌的字
|
||||
@property (nonatomic,copy) NSString *inRoomNameplateWord;
|
||||
///类型
|
||||
@property (nonatomic,assign) NSInteger defUser;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// XPUserEnterRoomExtModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by 冯硕 on 2021/12/16.
|
||||
//
|
||||
|
||||
#import "XPUserEnterRoomExtModel.h"
|
||||
|
||||
@implementation XPUserEnterRoomExtModel
|
||||
|
||||
@end
|
@@ -16,6 +16,7 @@
|
||||
#import "NSObject+MJExtension.h"
|
||||
///Model
|
||||
#import "GiftInfoModel.h"
|
||||
#import "XPUserEnterRoomExtModel.h"
|
||||
///P
|
||||
#import "XPRoomProtocol.h"
|
||||
|
||||
@@ -57,14 +58,16 @@
|
||||
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
|
||||
request.roomId = roomId;
|
||||
//设置ext
|
||||
NSMutableDictionary *extSource = [NSMutableDictionary dictionary];
|
||||
//defUser
|
||||
if (userInfo) {
|
||||
[extSource setObject:@(userInfo.defUser) forKey:@"defUser"];
|
||||
[extSource setObject:@(userInfo.erbanNo) forKey:@"erbanNo"];
|
||||
}
|
||||
|
||||
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extSource forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||
XPUserEnterRoomExtModel * extModel = [[XPUserEnterRoomExtModel alloc] init];
|
||||
extModel.defUser = userInfo.defUser;
|
||||
extModel.erbanNo = userInfo.erbanNo;
|
||||
extModel.carName = userInfo.carName;
|
||||
extModel.inRoomNameplatePic = userInfo.nameplatePic;
|
||||
extModel.inRoomNameplateWord = userInfo.nameplateWord;
|
||||
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
|
||||
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
|
||||
extModel.experUrl = userInfo.userLevelVo.experUrl;
|
||||
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
|
||||
request.roomExt = [ext toJSONString];
|
||||
|
||||
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {
|
||||
|
@@ -8,9 +8,10 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "XPRoomAnimationHitView.h"
|
||||
#import "RoomHostDelegate.h"
|
||||
#import "RoomGuestDelegate.h"
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomAnimationView : XPRoomAnimationHitView
|
||||
@interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
|
||||
@end
|
||||
|
||||
|
@@ -33,7 +33,7 @@
|
||||
#import "XPRoomCandyGiftView.h"
|
||||
|
||||
|
||||
@interface XPRoomAnimationView ()<SVGAPlayerDelegate, NIMChatManagerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate>
|
||||
@interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate>
|
||||
///展示的不同层级
|
||||
///最底层的
|
||||
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
|
||||
@@ -74,18 +74,21 @@
|
||||
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
|
||||
///糖果树礼物的队列
|
||||
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
|
||||
#pragma mark - 进房动画的
|
||||
@property (nonatomic, strong) NSMutableArray<NSString *> *carEffectQueue;
|
||||
@property (nonatomic,strong) SVGAImageView *carEffectView;
|
||||
@end
|
||||
|
||||
@implementation XPRoomAnimationView
|
||||
|
||||
- (void)dealloc {
|
||||
[NSObject cancelPreviousPerformRequestsWithTarget:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
|
||||
}
|
||||
|
||||
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
||||
self = [super init];
|
||||
if (self) {
|
||||
[[NIMSDK sharedSDK].chatManager addDelegate:self];
|
||||
[[NIMSDK sharedSDK].broadcastManager addDelegate:self];
|
||||
self.delegate = delegate;
|
||||
[self initSubViews];
|
||||
@@ -114,13 +117,6 @@
|
||||
make.edges.mas_equalTo(self);
|
||||
}];
|
||||
}
|
||||
#pragma mark - NIMChatManagerDelegate
|
||||
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
|
||||
for (NIMMessage * message in messages) {
|
||||
[self handleMessage:message];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - NIMBroadcastDelegate
|
||||
// 广播消息
|
||||
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{
|
||||
@@ -132,17 +128,8 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//发送消息成功回调
|
||||
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error {
|
||||
[self handleMessage:message];
|
||||
}
|
||||
|
||||
- (void)handleMessage:(NIMMessage *)message {
|
||||
if (message.session.sessionType == NIMSessionTypeChatroom && message.messageType == NIMMessageTypeCustom) {
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
#pragma mark - RoomGuestDelegate
|
||||
- (void)handleNIMCustomMessage:(AttachmentModel *)attachment {
|
||||
if (attachment.first == CustomMessageType_Gift) {
|
||||
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
|
||||
@@ -159,9 +146,53 @@
|
||||
[self receiveLuckyGiftBigPrize:attachment];
|
||||
} else if (attachment.first == CustomMessageType_Candy_Tree && (attachment.second == Custom_Message_Sub_Candy_Tree_InRoom_NeedAllMicSend || attachment.second == Custom_Message_Sub_Candy_Tree_AllRoom_Notify) ) {//糖果树
|
||||
[self receiveCandyTreeGiftHighLevle:attachment];
|
||||
} else if (attachment.first == CustomMessageType_Car_Notify && attachment.second == Custom_Message_Sub_Car_EnterRoom ) {//座驾进房
|
||||
[self receiveDriveCarEnterRoom:attachment];
|
||||
}
|
||||
}
|
||||
#pragma mark - 座驾的动画
|
||||
- (void)receiveDriveCarEnterRoom:(AttachmentModel *)attatchment {
|
||||
NSString * effect = attatchment.data[@"effect"];
|
||||
if (effect.length <= 0) return;
|
||||
if (self.carEffectQueue.count == 0) {
|
||||
[self playCarEffect:effect];
|
||||
return;
|
||||
}
|
||||
[self.carEffectQueue addObject:effect];
|
||||
}
|
||||
|
||||
- (void)playCarEffect:(NSString *)carEffect {
|
||||
if (self.carEffectView.superview == nil) {
|
||||
[self.middleLevelView addSubview:self.carEffectView];
|
||||
[self.carEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.middleLevelView);
|
||||
make.width.mas_equalTo(KScreenWidth);
|
||||
make.height.mas_equalTo(KScreenHeight);
|
||||
}];
|
||||
}
|
||||
[self.parser parseWithURL:[NSURL URLWithString:carEffect] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
|
||||
if (videoItem != nil) {
|
||||
CGFloat width = videoItem.videoSize.width;
|
||||
CGFloat height = videoItem.videoSize.height;
|
||||
if (width > height) {
|
||||
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
} else {//高大于宽
|
||||
CGFloat resizeH = KScreenWidth * height / width;//按照屏幕的宽度去缩放,获得高度
|
||||
if (resizeH > KScreenHeight) {//如果大于屏幕高度,填充
|
||||
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFill;
|
||||
} else {//小于屏幕高度,
|
||||
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
}
|
||||
self.carEffectView.alpha = 1;
|
||||
self.carEffectView.loops = 1;
|
||||
self.carEffectView.clearsAfterStop = YES;
|
||||
self.carEffectView.videoItem = videoItem;
|
||||
[self.carEffectView startAnimation];
|
||||
}
|
||||
} failureBlock:^(NSError * _Nullable error) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - 糖果树横幅动画
|
||||
@@ -714,7 +745,7 @@
|
||||
if (self.giftEffectView.superview == nil) {
|
||||
[self.middleLevelView addSubview:self.giftEffectView];
|
||||
[self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.center.mas_equalTo(self.lowLevelView);
|
||||
make.center.mas_equalTo(self.middleLevelView);
|
||||
make.width.mas_equalTo(KScreenWidth);
|
||||
make.height.mas_equalTo(KScreenHeight);
|
||||
}];
|
||||
@@ -758,6 +789,11 @@
|
||||
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
|
||||
if (player == self.giftEffectView) {
|
||||
self.giftEffectView.hidden = YES;
|
||||
} else if(self.carEffectView) {
|
||||
if (self.carEffectQueue.count > 0) {
|
||||
[self playCarEffect:self.carEffectQueue.firstObject];
|
||||
[self.carEffectQueue removeObjectAtIndex:0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -869,4 +905,24 @@
|
||||
return _candyTreegiftQueue;
|
||||
}
|
||||
|
||||
- (NSMutableArray<NSString *> *)carEffectQueue {
|
||||
if (_carEffectQueue == nil) {
|
||||
_carEffectQueue = [NSMutableArray array];
|
||||
}
|
||||
return _carEffectQueue;
|
||||
}
|
||||
|
||||
- (SVGAImageView *)carEffectView {
|
||||
if (_carEffectView == nil) {
|
||||
_carEffectView = [[SVGAImageView alloc]init];
|
||||
_carEffectView.delegate = self;
|
||||
_carEffectView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_carEffectView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight);
|
||||
_carEffectView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.3];
|
||||
_carEffectView.alpha = 0;
|
||||
_carEffectView.userInteractionEnabled = NO;
|
||||
}
|
||||
return _carEffectView;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -23,6 +23,7 @@
|
||||
#import "UserInfoModel.h"
|
||||
#import "MicroStateModel.h"
|
||||
#import "RoomInfoModel.h"
|
||||
#import "XPUserEnterRoomExtModel.h"
|
||||
|
||||
#import "NetImageView.h"
|
||||
|
||||
@@ -105,12 +106,20 @@
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
NIMChatroomNotificationMember *member = content.targets[0];
|
||||
NIMMessageChatroomExtension * messageExt = (NIMMessageChatroomExtension *)message.messageExt;
|
||||
switch (content.eventType) {
|
||||
case NIMChatroomEventTypeEnter:///进入房间
|
||||
{
|
||||
NSString* nick = member.nick.length > 0 ? member.nick : @"";
|
||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||
NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from];
|
||||
XPUserEnterRoomExtModel * extModel = [XPUserEnterRoomExtModel modelWithDictionary:dic];;
|
||||
[attribute appendAttributedString:[self createTextAttribute:nick color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
||||
if (extModel.carName.length > 0) {
|
||||
[attribute appendAttributedString:[self createTextAttribute:@" 驾着 " color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:extModel.carName color:[ThemeColor messageNickColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createSapceAttribute:2]];
|
||||
}
|
||||
[attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
|
||||
[self attributeAddHihtLight:attribute uid:message.from.integerValue];
|
||||
return attribute;
|
||||
|
@@ -169,6 +169,26 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)userEnterRoomSuccess {
|
||||
if (self.userInfo.carEffect.length > 0) {
|
||||
AttachmentModel *attachment = [[AttachmentModel alloc]init];
|
||||
attachment.first = CustomMessageType_Car_Notify;
|
||||
attachment.second = Custom_Message_Sub_Car_EnterRoom;
|
||||
NSMutableDictionary *att = [NSMutableDictionary dictionary];
|
||||
[att setValue:self.userInfo.carEffect forKey:@"effect"];
|
||||
[att setValue:self.userInfo.nick forKey:@"nick"];
|
||||
attachment.data = att;
|
||||
NSString *sessionID = [NSString stringWithFormat:@"%ld",self.roomInfo.roomId];
|
||||
NIMMessage *message = [[NIMMessage alloc]init];
|
||||
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
||||
object.attachment = attachment;
|
||||
message.messageObject = object;
|
||||
//构造会话
|
||||
NIMSession *session = [NIMSession session:sessionID type:NIMSessionTypeChatroom];
|
||||
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPRoomProtocol
|
||||
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
|
||||
self.roomInfo = roomInfo;
|
||||
@@ -271,6 +291,8 @@
|
||||
case NIMChatroomEventTypeEnter:
|
||||
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
|
||||
onLineNumber += 1;
|
||||
}else {///如果是自己的话 如果有坐骑的话
|
||||
[self userEnterRoomSuccess];
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeAddBlack:
|
||||
@@ -288,6 +310,7 @@
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
[self.stageView handleNIMCustomMessage:obj.attachment];
|
||||
[self.animationView handleNIMCustomMessage:obj.attachment];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -300,6 +323,7 @@
|
||||
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
||||
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
||||
[self.stageView handleNIMCustomMessage:obj.attachment];
|
||||
[self.animationView handleNIMCustomMessage:obj.attachment];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user