驾驶座驾进房

This commit is contained in:
fengshuo
2021-12-16 20:22:01 +08:00
parent 286d617fba
commit 5c1e4ed381
11 changed files with 216 additions and 46 deletions

View File

@@ -171,6 +171,7 @@
E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C75276AEB5100858D6D /* NameplateModel.m */; }; E82D5C76276AEB5100858D6D /* NameplateModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C75276AEB5100858D6D /* NameplateModel.m */; };
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E82D5C79276B25D100858D6D /* SpriteSheetImageManager.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 */; }; 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 */; }; E82EE0F8272FDDFA00D15DC1 /* UserPrivacyView.m in Sources */ = {isa = PBXBuildFile; fileRef = E82EE0F7272FDDFA00D15DC1 /* UserPrivacyView.m */; };
E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; }; E833ED0D274FAD1C00A2463B /* XPKickUserModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */; };
E838D9A0275E1BF60079E0B5 /* XPRoomAnimationView.m in Sources */ = {isa = PBXBuildFile; fileRef = E838D99F275E1BF60079E0B5 /* XPRoomAnimationView.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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; 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>"; }; E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPKickUserModel.h; sourceTree = "<group>"; };
@@ -2311,6 +2314,8 @@
children = ( children = (
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */, E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */,
E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */, E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */,
E82D5C7E276B635600858D6D /* XPUserEnterRoomExtModel.h */,
E82D5C7F276B635600858D6D /* XPUserEnterRoomExtModel.m */,
); );
path = CustomMessage; path = CustomMessage;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -3351,6 +3356,7 @@
E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */, E88B5CA526FB088600DA9178 /* XPMineTeenagerViewController.m in Sources */,
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */, E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */, E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */,
E82D5C80276B635600858D6D /* XPUserEnterRoomExtModel.m in Sources */,
E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */, E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */,
18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */, 18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */,
E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */, E89DA67527009ACD008483C1 /* XPMineRechargeNavView.m in Sources */,

View File

@@ -58,6 +58,14 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *nameplateWord; @property (nonatomic, copy) NSString *nameplateWord;
///如果在房间有直播中字段 ///如果在房间有直播中字段
@property(nonatomic, copy) NSString * roomUid; @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 @end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END

View File

@@ -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 @end

View File

@@ -20,6 +20,8 @@ typedef NS_ENUM(NSUInteger, CustomMessageType) {
CustomMessageType_Queue = 8, CustomMessageType_Queue = 8,
///全麦送 ///全麦送
CustomMessageType_AllMicroSend = 12, CustomMessageType_AllMicroSend = 12,
///座驾进房动画
CustomMessageType_Car_Notify = 15,
///踢出房间 ///踢出房间
CustomMessageType_Kick_User = 18, CustomMessageType_Kick_User = 18,
///糖果树 ///糖果树
@@ -75,6 +77,11 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubAllMicroSend) {
Custom_Message_Sub_AllMicroLuckySend = 125, Custom_Message_Sub_AllMicroLuckySend = 125,
}; };
///first == CustomMessageType_Car_Notify
typedef NS_ENUM(NSUInteger, CustomMessageSubCar) {
Custom_Message_Sub_Car_EnterRoom = 159, //进房动画
};
///first = CustomMessageType_Kick_User ///first = CustomMessageType_Kick_User
typedef NS_ENUM(NSUInteger, CustomNotificationSubKick) { typedef NS_ENUM(NSUInteger, CustomNotificationSubKick) {
///拉黑 ///拉黑

View File

@@ -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

View File

@@ -0,0 +1,12 @@
//
// XPUserEnterRoomExtModel.m
// xplan-ios
//
// Created by on 2021/12/16.
//
#import "XPUserEnterRoomExtModel.h"
@implementation XPUserEnterRoomExtModel
@end

View File

@@ -16,6 +16,7 @@
#import "NSObject+MJExtension.h" #import "NSObject+MJExtension.h"
///Model ///Model
#import "GiftInfoModel.h" #import "GiftInfoModel.h"
#import "XPUserEnterRoomExtModel.h"
///P ///P
#import "XPRoomProtocol.h" #import "XPRoomProtocol.h"
@@ -57,14 +58,16 @@
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init]; NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
request.roomId = roomId; request.roomId = roomId;
//ext //ext
NSMutableDictionary *extSource = [NSMutableDictionary dictionary]; XPUserEnterRoomExtModel * extModel = [[XPUserEnterRoomExtModel alloc] init];
//defUser extModel.defUser = userInfo.defUser;
if (userInfo) { extModel.erbanNo = userInfo.erbanNo;
[extSource setObject:@(userInfo.defUser) forKey:@"defUser"]; extModel.carName = userInfo.carName;
[extSource setObject:@(userInfo.erbanNo) forKey:@"erbanNo"]; extModel.inRoomNameplatePic = userInfo.nameplatePic;
} extModel.inRoomNameplateWord = userInfo.nameplateWord;
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extSource forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]]; 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]; request.roomExt = [ext toJSONString];
[[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) { [[NIMSDK sharedSDK].chatroomManager enterChatroom:request completion:^(NSError * _Nullable error, NIMChatroom * _Nullable chatroom, NIMChatroomMember * _Nullable me) {

View File

@@ -8,9 +8,10 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "XPRoomAnimationHitView.h" #import "XPRoomAnimationHitView.h"
#import "RoomHostDelegate.h" #import "RoomHostDelegate.h"
#import "RoomGuestDelegate.h"
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
@interface XPRoomAnimationView : XPRoomAnimationHitView @interface XPRoomAnimationView : XPRoomAnimationHitView <RoomGuestDelegate>
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate; - (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate;
@end @end

View File

@@ -33,7 +33,7 @@
#import "XPRoomCandyGiftView.h" #import "XPRoomCandyGiftView.h"
@interface XPRoomAnimationView ()<SVGAPlayerDelegate, NIMChatManagerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate> @interface XPRoomAnimationView ()<SVGAPlayerDelegate,NIMBroadcastManagerDelegate, XPRoomGiftBroadcastViewDelegate>
/// ///
/// ///
@property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView; @property (nonatomic,strong) XPRoomAnimationHitView * lowLevelView;
@@ -74,18 +74,21 @@
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray; @property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
/// ///
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue; @property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSString *> *carEffectQueue;
@property (nonatomic,strong) SVGAImageView *carEffectView;
@end @end
@implementation XPRoomAnimationView @implementation XPRoomAnimationView
- (void)dealloc { - (void)dealloc {
[NSObject cancelPreviousPerformRequestsWithTarget:self]; [NSObject cancelPreviousPerformRequestsWithTarget:self];
[[NIMSDK sharedSDK].broadcastManager removeDelegate:self];
} }
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate { - (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
self = [super init]; self = [super init];
if (self) { if (self) {
[[NIMSDK sharedSDK].chatManager addDelegate:self];
[[NIMSDK sharedSDK].broadcastManager addDelegate:self]; [[NIMSDK sharedSDK].broadcastManager addDelegate:self];
self.delegate = delegate; self.delegate = delegate;
[self initSubViews]; [self initSubViews];
@@ -114,13 +117,6 @@
make.edges.mas_equalTo(self); make.edges.mas_equalTo(self);
}]; }];
} }
#pragma mark - NIMChatManagerDelegate
- (void)onRecvMessages:(NSArray<NIMMessage *> *)messages {
for (NIMMessage * message in messages) {
[self handleMessage:message];
}
}
#pragma mark - NIMBroadcastDelegate #pragma mark - NIMBroadcastDelegate
// 广 // 广
- (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{ - (void)onReceiveBroadcastMessage:(NIMBroadcastMessage *)broadcastMessage{
@@ -132,36 +128,71 @@
} }
} }
} }
#pragma mark - RoomGuestDelegate
// - (void)handleNIMCustomMessage:(AttachmentModel *)attachment {
- (void)sendMessage:(NIMMessage *)message didCompleteWithError:(NSError *)error { if (attachment.first == CustomMessageType_Gift) {
[self handleMessage:message]; GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend;
receiveInfo.isBatch = YES;
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_AllMicroSend) { //
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_LuckyBag) {//
[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)handleMessage:(NIMMessage *)message { - (void)playCarEffect:(NSString *)carEffect {
if (message.session.sessionType == NIMSessionTypeChatroom && message.messageType == NIMMessageTypeCustom) { if (self.carEffectView.superview == nil) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; [self.middleLevelView addSubview:self.carEffectView];
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { [self.carEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
AttachmentModel *attachment = (AttachmentModel *)obj.attachment; make.center.mas_equalTo(self.middleLevelView);
if (attachment.first == CustomMessageType_Gift) { make.width.mas_equalTo(KScreenWidth);
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data]; make.height.mas_equalTo(KScreenHeight);
receiveInfo.isLuckyBagGift = attachment.second == Custom_Message_Sub_Gift_LuckySend; }];
receiveInfo.isBatch = YES;
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_AllMicroSend) { //
GiftReceiveInfoModel * receiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
receiveInfo.isLuckyBagGift = (attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
receiveInfo.isBatch = (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend);
[self receiveGiftHandleSendGiftAnimation:attachment];
[self receiveGift:receiveInfo];
} else if (attachment.first == CustomMessageType_LuckyBag) {//
[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];
}
}
} }
[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 - #pragma mark -
@@ -714,7 +745,7 @@
if (self.giftEffectView.superview == nil) { if (self.giftEffectView.superview == nil) {
[self.middleLevelView addSubview:self.giftEffectView]; [self.middleLevelView addSubview:self.giftEffectView];
[self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) { [self.giftEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.lowLevelView); make.center.mas_equalTo(self.middleLevelView);
make.width.mas_equalTo(KScreenWidth); make.width.mas_equalTo(KScreenWidth);
make.height.mas_equalTo(KScreenHeight); make.height.mas_equalTo(KScreenHeight);
}]; }];
@@ -758,6 +789,11 @@
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player { - (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
if (player == self.giftEffectView) { if (player == self.giftEffectView) {
self.giftEffectView.hidden = YES; 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; 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 @end

View File

@@ -23,6 +23,7 @@
#import "UserInfoModel.h" #import "UserInfoModel.h"
#import "MicroStateModel.h" #import "MicroStateModel.h"
#import "RoomInfoModel.h" #import "RoomInfoModel.h"
#import "XPUserEnterRoomExtModel.h"
#import "NetImageView.h" #import "NetImageView.h"
@@ -105,12 +106,20 @@
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject; NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content; NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
NIMChatroomNotificationMember *member = content.targets[0]; NIMChatroomNotificationMember *member = content.targets[0];
NIMMessageChatroomExtension * messageExt = (NIMMessageChatroomExtension *)message.messageExt;
switch (content.eventType) { switch (content.eventType) {
case NIMChatroomEventTypeEnter:/// case NIMChatroomEventTypeEnter:///
{ {
NSString* nick = member.nick.length > 0 ? member.nick : @""; NSString* nick = member.nick.length > 0 ? member.nick : @"";
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init]; 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]]; [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]]; [attribute appendAttributedString:[self createTextAttribute:@"进入了房间" color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[self attributeAddHihtLight:attribute uid:message.from.integerValue]; [self attributeAddHihtLight:attribute uid:message.from.integerValue];
return attribute; return attribute;

View File

@@ -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 #pragma mark - XPRoomProtocol
- (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo { - (void)initEnterRoomSuccess:(RoomInfoModel *)roomInfo user:(UserInfoModel *)userInfo {
self.roomInfo = roomInfo; self.roomInfo = roomInfo;
@@ -271,6 +291,8 @@
case NIMChatroomEventTypeEnter: case NIMChatroomEventTypeEnter:
if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue) { if (content.source.userId.integerValue != [AccountInfoStorage instance].getUid.integerValue) {
onLineNumber += 1; onLineNumber += 1;
}else {///
[self userEnterRoomSuccess];
} }
break; break;
case NIMChatroomEventTypeAddBlack: case NIMChatroomEventTypeAddBlack:
@@ -288,6 +310,7 @@
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[self.stageView handleNIMCustomMessage:obj.attachment]; [self.stageView handleNIMCustomMessage:obj.attachment];
[self.animationView handleNIMCustomMessage:obj.attachment];
} }
} }
} }
@@ -300,6 +323,7 @@
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject; NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) { if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
[self.stageView handleNIMCustomMessage:obj.attachment]; [self.stageView handleNIMCustomMessage:obj.attachment];
[self.animationView handleNIMCustomMessage:obj.attachment];
} }
} }
} }