进房动画 铭牌显示

This commit is contained in:
fengshuo
2021-12-17 15:18:34 +08:00
parent 5c1e4ed381
commit f7f6df70bf
21 changed files with 329 additions and 73 deletions

View File

@@ -171,7 +171,6 @@
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 */; };
@@ -235,6 +234,13 @@
E890BC07273CF1800007C46B /* XPGiftCountCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC06273CF1800007C46B /* XPGiftCountCollectionViewCell.m */; };
E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC0C273D09A50007C46B /* XPGiftCountView.m */; };
E890BC10273D23F00007C46B /* GiftInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E890BC0F273D23F00007C46B /* GiftInfoModel.m */; };
E8937AC7276C3EDE00B2C7E1 /* svga_member_in_lv40.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC0276C3EDD00B2C7E1 /* svga_member_in_lv40.svga */; };
E8937AC8276C3EDE00B2C7E1 /* svga_member_in_lv70.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC1276C3EDE00B2C7E1 /* svga_member_in_lv70.svga */; };
E8937AC9276C3EDE00B2C7E1 /* svga_member_in_lv90.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC2276C3EDE00B2C7E1 /* svga_member_in_lv90.svga */; };
E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC3276C3EDE00B2C7E1 /* svga_member_in_lv50.svga */; };
E8937ACB276C3EDE00B2C7E1 /* svga_member_in_lv60.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC4276C3EDE00B2C7E1 /* svga_member_in_lv60.svga */; };
E8937ACC276C3EDE00B2C7E1 /* svga_member_in_lv80.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC5276C3EDE00B2C7E1 /* svga_member_in_lv80.svga */; };
E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */ = {isa = PBXBuildFile; fileRef = E8937AC6276C3EDE00B2C7E1 /* svga_member_in_lv30.svga */; };
E899C68927508F4E00E189E5 /* XPUserCardInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E899C68827508F4E00E189E5 /* XPUserCardInfoModel.m */; };
E899C68C275093B800E189E5 /* XPUserCardMicroItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E899C68B275093B800E189E5 /* XPUserCardMicroItemModel.m */; };
E89D60BA271D643A001F8895 /* Api+Room.m in Sources */ = {isa = PBXBuildFile; fileRef = E89D60B9271D643A001F8895 /* Api+Room.m */; };
@@ -683,8 +689,6 @@
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>"; };
@@ -814,6 +818,13 @@
E890BC0C273D09A50007C46B /* XPGiftCountView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPGiftCountView.m; sourceTree = "<group>"; };
E890BC0E273D23F00007C46B /* GiftInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftInfoModel.h; sourceTree = "<group>"; };
E890BC0F273D23F00007C46B /* GiftInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftInfoModel.m; sourceTree = "<group>"; };
E8937AC0276C3EDD00B2C7E1 /* svga_member_in_lv40.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv40.svga; sourceTree = "<group>"; };
E8937AC1276C3EDE00B2C7E1 /* svga_member_in_lv70.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv70.svga; sourceTree = "<group>"; };
E8937AC2276C3EDE00B2C7E1 /* svga_member_in_lv90.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv90.svga; sourceTree = "<group>"; };
E8937AC3276C3EDE00B2C7E1 /* svga_member_in_lv50.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv50.svga; sourceTree = "<group>"; };
E8937AC4276C3EDE00B2C7E1 /* svga_member_in_lv60.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv60.svga; sourceTree = "<group>"; };
E8937AC5276C3EDE00B2C7E1 /* svga_member_in_lv80.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv80.svga; sourceTree = "<group>"; };
E8937AC6276C3EDE00B2C7E1 /* svga_member_in_lv30.svga */ = {isa = PBXFileReference; lastKnownFileType = file; path = svga_member_in_lv30.svga; sourceTree = "<group>"; };
E899C68727508F4E00E189E5 /* XPUserCardInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPUserCardInfoModel.h; sourceTree = "<group>"; };
E899C68827508F4E00E189E5 /* XPUserCardInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPUserCardInfoModel.m; sourceTree = "<group>"; };
E899C68A275093B700E189E5 /* XPUserCardMicroItemModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPUserCardMicroItemModel.h; sourceTree = "<group>"; };
@@ -2309,13 +2320,25 @@
path = MineInfo;
sourceTree = "<group>";
};
E8937ABF276C3ECF00B2C7E1 /* enterroom */ = {
isa = PBXGroup;
children = (
E8937AC6276C3EDE00B2C7E1 /* svga_member_in_lv30.svga */,
E8937AC0276C3EDD00B2C7E1 /* svga_member_in_lv40.svga */,
E8937AC3276C3EDE00B2C7E1 /* svga_member_in_lv50.svga */,
E8937AC4276C3EDE00B2C7E1 /* svga_member_in_lv60.svga */,
E8937AC1276C3EDE00B2C7E1 /* svga_member_in_lv70.svga */,
E8937AC5276C3EDE00B2C7E1 /* svga_member_in_lv80.svga */,
E8937AC2276C3EDE00B2C7E1 /* svga_member_in_lv90.svga */,
);
path = enterroom;
sourceTree = "<group>";
};
E899C68D2750DA3C00E189E5 /* CustomMessage */ = {
isa = PBXGroup;
children = (
E833ED0B274FAD1C00A2463B /* XPKickUserModel.h */,
E833ED0C274FAD1C00A2463B /* XPKickUserModel.m */,
E82D5C7E276B635600858D6D /* XPUserEnterRoomExtModel.h */,
E82D5C7F276B635600858D6D /* XPUserEnterRoomExtModel.m */,
);
path = CustomMessage;
sourceTree = "<group>";
@@ -2429,6 +2452,7 @@
E8A1E45C276220B100B294CA /* Sources */ = {
isa = PBXGroup;
children = (
E8937ABF276C3ECF00B2C7E1 /* enterroom */,
E8DEC98927637EA50078CB70 /* candyTree_open.svga */,
E8DEC98A27637EA50078CB70 /* candyTree_transform.svga */,
E8A1E45D276220DA00B294CA /* candyTree_banner.svga */,
@@ -3050,14 +3074,21 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E8937AC7276C3EDE00B2C7E1 /* svga_member_in_lv40.svga in Resources */,
E8A1E461276220DA00B294CA /* candyTree.svga in Resources */,
189DD53C26DE255600AB55B1 /* LaunchScreen.storyboard in Resources */,
E8937AC9276C3EDE00B2C7E1 /* svga_member_in_lv90.svga in Resources */,
E8937ACC276C3EDE00B2C7E1 /* svga_member_in_lv80.svga in Resources */,
E8937AC8276C3EDE00B2C7E1 /* svga_member_in_lv70.svga in Resources */,
E8DEC98B27637EA50078CB70 /* candyTree_open.svga in Resources */,
E8A1E460276220DA00B294CA /* candyTree_banner.svga in Resources */,
E8937ACA276C3EDE00B2C7E1 /* svga_member_in_lv50.svga in Resources */,
E8937ACD276C3EDE00B2C7E1 /* svga_member_in_lv30.svga in Resources */,
E8A1E462276220DA00B294CA /* candyTree_light.svga in Resources */,
189DD53926DE255600AB55B1 /* Assets.xcassets in Resources */,
E8DEC98C27637EA50078CB70 /* candyTree_transform.svga in Resources */,
186A52E726FC559700D67B2C /* yw_1222_0769.jpg in Resources */,
E8937ACB276C3EDE00B2C7E1 /* svga_member_in_lv60.svga in Resources */,
186A52E326FC559200D67B2C /* RPSDK.bundle in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3356,7 +3387,6 @@
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 */,

View File

@@ -66,6 +66,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,copy) NSString *headwearEffect;
///用户信息中的 头饰的动画 如果没有的话 就用这个 并不需要HeadwearModel 映射一下吧
@property (nonatomic,copy) NSString *headwearPic;
///头饰(新字段) 上麦的时候 在扩展字段中的 只用在坑位上
@property (nonatomic, copy) NSString *headWearUrl;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,35 +0,0 @@
//
// 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

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

View File

@@ -16,7 +16,7 @@
#import "NSObject+MJExtension.h"
///Model
#import "GiftInfoModel.h"
#import "XPUserEnterRoomExtModel.h"
#import "XPMessageRemoteExtModel.h"
///P
#import "XPRoomProtocol.h"
@@ -58,7 +58,7 @@
NIMChatroomEnterRequest *request = [[NIMChatroomEnterRequest alloc] init];
request.roomId = roomId;
//ext
XPUserEnterRoomExtModel * extModel = [[XPUserEnterRoomExtModel alloc] init];
XPMessageRemoteExtModel * extModel = [[XPMessageRemoteExtModel alloc] init];
extModel.defUser = userInfo.defUser;
extModel.erbanNo = userInfo.erbanNo;
extModel.carName = userInfo.carName;
@@ -67,6 +67,8 @@
extModel.charmUrl = userInfo.userLevelVo.charmUrl;
extModel.experLevelSeq = userInfo.userLevelVo.experLevelSeq;
extModel.experUrl = userInfo.userLevelVo.experUrl;
extModel.newUser = userInfo.newUser;
NSMutableDictionary *ext = [NSMutableDictionary dictionaryWithObject:extModel.model2dictionary forKey:[NSString stringWithFormat:@"%ld", userInfo.uid]];
request.roomExt = [ext toJSONString];

View File

@@ -27,6 +27,7 @@
#import "XPGiftBigPrizeModel.h"
#import "XPGiftBannerUserInfoModel.h"
#import "XPRoomGiftBroadCastModel.h"
#import "XPMessageRemoteExtModel.h"
///View
#import "XPRoomGiftBannerView.h"
#import "XPRoomGiftBroadcastView.h"
@@ -74,9 +75,12 @@
@property (nonatomic,strong) NSMutableSet<NetImageView *> * giftVisibleArray;
///
@property (nonatomic,strong) NSMutableArray *candyTreegiftQueue;
#pragma mark -
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSString *> *carEffectQueue;
@property (nonatomic,strong) SVGAImageView *carEffectView;
#pragma mark -
@property (nonatomic, strong) NSMutableArray<NSDictionary *> *enterEffectQueue;
@property (nonatomic,strong) SVGAImageView *enterEffectView;
@end
@implementation XPRoomAnimationView
@@ -150,13 +154,80 @@
[self receiveDriveCarEnterRoom:attachment];
}
}
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
if (content.eventType == NIMChatroomEventTypeEnter) {
NIMMessageChatroomExtension * messageExt = (NIMMessageChatroomExtension *)message.messageExt;
NSDictionary * dic = [(NSDictionary *)messageExt.roomExt.toJSONObject objectForKey:message.from];
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithJSON:dic];
[self userEnterRoom:content ext:extModel];
}
}
#pragma mark - XXX
- (void)userEnterRoom:(NIMChatroomNotificationContent *)content ext:(XPMessageRemoteExtModel *)extModel {
if (extModel.experLevelSeq < 30) return;
NSString * title = [NSString stringWithFormat:@"%@进入了房间", content.source.nick];
if (self.enterEffectQueue.count ==0) {
[self playUserEnterRoomAnimation:title experLevelSeq:extModel.experLevelSeq];
}
NSDictionary * dic= @{@"title":title, @"experLevelSeq":[NSString stringWithFormat:@"%ld", extModel.experLevelSeq]};
[self.enterEffectQueue addObject:dic];
}
- (void)playUserEnterRoomAnimation:(NSString *)title experLevelSeq:(NSInteger)experLevelSeq {
NSString * path;
if (experLevelSeq >= 30 && experLevelSeq <= 39) {
path = @"svga_member_in_lv30";
} else if (experLevelSeq >= 40 && experLevelSeq <= 49) {
path = @"svga_member_in_lv40";
} else if (experLevelSeq >= 50 && experLevelSeq <= 59) {
path = @"svga_member_in_lv50";
} else if (experLevelSeq >= 60 && experLevelSeq <= 69) {
path = @"svga/svga_member_in_lv60";
} else if (experLevelSeq >= 70 && experLevelSeq <= 79) {
path = @"svga/svga_member_in_lv70";
} else if (experLevelSeq >= 80 && experLevelSeq <= 89) {
path = @"svga/svga_member_in_lv80";
} else {
path = @"svga/svga_member_in_lv90";
}
if (self.enterEffectView.superview == nil) {
self.enterEffectView.frame = CGRectMake(KScreenWidth, 339 + kSafeAreaTopHeight, KScreenWidth, 40);
[self.lowLevelView addSubview:self.enterEffectView];
}
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] initWithString:title attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:26], NSForegroundColorAttributeName:[UIColor whiteColor]}];
@kWeakify(self);
[self.parser parseWithNamed:path inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
@kStrongify(self);
self.enterEffectView.loops = 1;
self.enterEffectView.hidden = NO;
self.enterEffectView.clearsAfterStop = NO;
self.enterEffectView.alpha = 1;
self.enterEffectView.videoItem = videoItem;
[self.enterEffectView setAttributedText:attribute forKey:@"room_text"];
[self.enterEffectView startAnimation];
} failureBlock:^(NSError * _Nonnull error) {
}];
[UIView animateWithDuration:0.5 animations:^{
self.enterEffectView.frame = CGRectMake(0, 339 + kSafeAreaTopHeight, KScreenWidth, 40);
} completion:^(BOOL finished) {
}];
}
#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];
}
@@ -184,6 +255,7 @@
self.giftEffectView.contentMode = UIViewContentModeScaleAspectFit;
}
}
self.carEffectView.hidden = NO;
self.carEffectView.alpha = 1;
self.carEffectView.loops = 1;
self.carEffectView.clearsAfterStop = YES;
@@ -789,10 +861,21 @@
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
if (player == self.giftEffectView) {
self.giftEffectView.hidden = YES;
} else if(self.carEffectView) {
} else if(player == self.carEffectView) {
self.carEffectView.hidden = YES;
[self.carEffectView removeFromSuperview];
[self.carEffectQueue removeObjectAtIndex:0];
if (self.carEffectQueue.count > 0) {
[self playCarEffect:self.carEffectQueue.firstObject];
[self.carEffectQueue removeObjectAtIndex:0];
}
} else if(player == self.enterEffectView) {
self.enterEffectView.hidden = YES;
[self.enterEffectView removeFromSuperview];
[self.enterEffectQueue removeObjectAtIndex:0];
if (self.enterEffectQueue.count > 0) {
NSString * title = [self.enterEffectQueue.firstObject objectForKey:@"title"];
NSInteger experLevelSeq = [(NSString *)[self.enterEffectQueue.firstObject objectForKey:@"experLevelSeq"] integerValue];
[self playUserEnterRoomAnimation:title experLevelSeq:experLevelSeq];
}
}
}
@@ -925,4 +1008,24 @@
return _carEffectView;
}
- (NSMutableArray<NSDictionary *> *)enterEffectQueue {
if (_enterEffectQueue == nil) {
_enterEffectQueue = [NSMutableArray array];
}
return _enterEffectQueue;
}
- (SVGAImageView *)enterEffectView {
if (_enterEffectView == nil) {
_enterEffectView = [[SVGAImageView alloc]init];
_enterEffectView.delegate = self;
_enterEffectView.contentMode = UIViewContentModeScaleAspectFit;
_enterEffectView.frame = CGRectMake(0, 0, KScreenWidth, 40);
_enterEffectView.backgroundColor = [UIColor clearColor];
_enterEffectView.alpha = 0;
_enterEffectView.userInteractionEnabled = NO;
}
return _enterEffectView;
}
@end

View File

@@ -12,8 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface XPMessageRemoteExtModel : NSObject
///魅力等级
@property (nonatomic,copy) NSString *charmUrl;
///
@property (nonatomic,copy) NSString *erbanNo;
@property (nonatomic,assign) NSInteger erbanNo;
///经验等级
@property (nonatomic,copy) NSString *experUrl;
///账号的类型
@@ -24,6 +23,18 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic,assign) BOOL hasPrettyErbanNo;
///是否是官方 安卓是这样用的 写上吧
@property (nonatomic,assign) BOOL official;
///座驾名称
@property (nonatomic,copy) NSString *carName;
///等级编号
@property (nonatomic,assign) NSInteger experLevelSeq;
///跟随的
@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;
@end

View File

@@ -8,6 +8,7 @@
#import "XPRoomMessageParser.h"
#import <YYText/YYText.h>
#import <NIMSDK/NIMSDK.h>
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor+Room.h"
#import "XPRoomMessageConstant.h"
@@ -23,7 +24,6 @@
#import "UserInfoModel.h"
#import "MicroStateModel.h"
#import "RoomInfoModel.h"
#import "XPUserEnterRoomExtModel.h"
#import "NetImageView.h"
@@ -87,6 +87,11 @@
[attribute appendAttributedString:[self createUrlImageAttribute:model.experUrl]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
if (model.inRoomNameplatePic.length > 0 && model.inRoomNameplateWord.length > 0) {
[attribute appendAttributedString:[self createNameplateAttibute:model.inRoomNameplateWord image:model.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
[attribute appendAttributedString:[self createTextAttribute:nick color:[ThemeColor messageDefaultTextColor] font:kRoomMessageDefalutFont]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
[attribute appendAttributedString:[self createTextAttribute:message.text color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
@@ -113,8 +118,14 @@
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];;
XPMessageRemoteExtModel * extModel = [XPMessageRemoteExtModel modelWithDictionary:dic];
if (extModel.inRoomNameplatePic.length > 0 && extModel.inRoomNameplateWord.length > 0) {
[attribute appendAttributedString:[self createNameplateAttibute:extModel.inRoomNameplateWord image:extModel.inRoomNameplatePic textFont:[UIFont systemFontOfSize:9]]];
[attribute appendAttributedString:[self createSapceAttribute:2]];
}
[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]];
@@ -401,6 +412,45 @@
}
#pragma mark - private base methods
///
- (NSMutableAttributedString *)createNameplateAttibute:(NSString *)tagName image:(NSString *)imageName textFont:(UIFont *)textFont {
NetImageConfig *config = [[NetImageConfig alloc]init];
///
config.autoLoad = YES;
NetImageView *imageView = [[NetImageView alloc]initWithUrl:imageName config:config];
UIImage* image = imageView.image;
if (image) {
CGFloat scale = image.size.width / image.size.height;
imageView.bounds = CGRectMake(0, 0, 20 * scale, 20);
} else {
NSURL *imgUrl = [NSURL URLWithString:imageName];
UIImage *myImage = [UIImage imageWithData:[NSData dataWithContentsOfURL:imgUrl]];
CGFloat scale = myImage.size.width / myImage.size.height;
if (scale == 0) {
imageView.bounds = CGRectMake(0, 0, 60, 20);
}else {
imageView.bounds = CGRectMake(0, 0, 20* scale, 20);
}
}
imageView.contentMode = UIViewContentModeScaleAspectFit;
//
UILabel *label = [[UILabel alloc] init];
label.textAlignment = NSTextAlignmentCenter;
label.font = [UIFont boldSystemFontOfSize:12];
label.adjustsFontSizeToFitWidth = YES;
label.textColor = UIColor.whiteColor;
label.text = tagName;
[imageView addSubview:label];
[label mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(27);
make.right.mas_equalTo(-8);
make.centerY.mas_equalTo(0);
}];
NSMutableAttributedString *string = [NSMutableAttributedString yy_attachmentStringWithContent:imageView contentMode:UIViewContentModeScaleAspectFit attachmentSize:imageView.bounds.size alignToFont:[UIFont boldSystemFontOfSize:12] alignment:YYTextVerticalAlignmentCenter];
return string;
}
///
/// @param imageUrl
- (NSMutableAttributedString *)createUrlImageAttribute:(NSString *)imageUrl {

View File

@@ -7,7 +7,7 @@
#import <Foundation/Foundation.h>
@class NIMChatroomNotificationContent;
@class NIMMessage;
@class AttachmentModel;
NS_ASSUME_NONNULL_BEGIN
@@ -19,7 +19,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)onRoomUpdate;
- (void)onUserUpdate;
- (void)onRoomEntered;
- (void)handleNIMNotificationMessage:(NIMChatroomNotificationContent *)content;
- (void)handleNIMNotificationMessage:(NIMMessage *)message;
- (void)handleNIMCustomMessage:(AttachmentModel *)attachment;
@end

View File

@@ -8,6 +8,7 @@
#import "MicroView.h"
///Third
#import <Masonry/Masonry.h>
#import <YYImage/YYAnimatedImageView.h>
///View
#import "MicroWaveView.h"
#import "MicroGiftValueView.h"
@@ -17,6 +18,8 @@
#import "ThemeColor+Room.h"
#import "XCCurrentVCStackManager.h"
#import "XPWebViewController.h"
#import "SpriteSheetImageManager.h"
#import "XPMacro.h"
#import "MicroQueueModel.h"
#import "MicroStateModel.h"
@@ -41,14 +44,17 @@
@property (nonatomic,strong) MicroGiftValueView *giftValueView;
///
@property (nonatomic,strong) MicroQueueModel *microModel;
///
@property (nonatomic,assign) BOOL isLeaveMode;
///Uid
@property (nonatomic,copy) NSString *roomUid;
///
@property (nonatomic,strong) UserInfoModel *userInfo;
///
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
///
@property (nonatomic, strong) SpriteSheetImageManager *manager;
@end
@implementation MicroView
- (instancetype)initWithFrame:(CGRect)frame {
@@ -82,6 +88,7 @@
- (void)initSubViews {
[self addSubview:self.animationView];
[self addSubview:self.avatarImageView];
[self addSubview:self.headWearImageView];
[self addSubview:self.micStateImageView];
[self addSubview:self.giftValueView];
@@ -95,6 +102,12 @@
make.edges.mas_equalTo(self.avatarImageView);
}];
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.avatarImageView);
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.2);
make.height.mas_equalTo(self.headWearImageView.mas_width);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.top.mas_equalTo(self);
make.height.mas_equalTo(self.mas_width);
@@ -182,6 +195,18 @@
self.avatarImageView.image = nil;
[self.postionLabel setBackgroundColor:[ThemeColor positionNormalNickBackColor]];
}
if (userInfo.headWearUrl.length > 0) {
self.headWearImageView.hidden = NO;
NSURL *url = [NSURL URLWithString:userInfo.headWearUrl];
@kWeakify(self);
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self);
self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) {
}];
} else {
self.headWearImageView.hidden = YES;
}
}
- (void)configGiftValue:(long long)giftValue {
@@ -297,5 +322,19 @@
return _giftValueView;
}
- (SpriteSheetImageManager *)manager {
if (!_manager) {
_manager = [[SpriteSheetImageManager alloc] init];
}
return _manager;
}
- (YYAnimatedImageView *)headWearImageView {
if (!_headWearImageView) {
_headWearImageView = [[YYAnimatedImageView alloc] init];
_headWearImageView.backgroundColor = [UIColor clearColor];
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _headWearImageView;
}
@end

View File

@@ -213,6 +213,18 @@
}
}
- (NSDictionary *)configUpdateChatRoomQueueExt:(UserInfoModel *)userInfo {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:@(userInfo.gender) forKey:@"gender"];
[dic setValue:userInfo.avatar forKey:@"avatar"];
[dic setValue:@(userInfo.uid) forKey:@"uid"];
[dic setValue:userInfo.nick forKey:@"nick"];
NSString * headWearUrl = userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic;
if (headWearUrl.length > 0) {
[dic setValue:headWearUrl forKey:@"headWearUrl"];
}
return dic;
}
#pragma mark - RoomGuestDelegate
- (void)onRoomEntered {
@@ -227,7 +239,9 @@
[self microQueueUpdated];
}
- (void)handleNIMNotificationMessage:(NIMChatroomNotificationContent *)content {
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
BOOL microQueueChanged = NO;
switch (content.eventType) {
case NIMChatroomEventTypeInfoUpdated: //
@@ -337,7 +351,7 @@
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = position;
request.value = [userInfo toJSONString];
request.value = [[self configUpdateChatRoomQueueExt:userInfo] toJSONString];
request.roomId = roomId;
request.transient = YES;
@@ -392,7 +406,7 @@
void(^nimUpQueue)(NSString*, BOOL) = ^ (NSString* up, BOOL isFromDownMic){
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = up;
request.value = [userInfo toJSONString];
request.value = [[self configUpdateChatRoomQueueExt:userInfo] toJSONString];
request.roomId = roomId;
request.transient = YES;
[[NIMSDK sharedSDK].chatroomManager updateChatroomQueueObject:request completion:^(NSError * _Nullable error) {

View File

@@ -8,12 +8,14 @@
#import "XPUserCardViewController.h"
///Third
#import <Masonry/Masonry.h>
#import <YYImage/YYAnimatedImageView.h>
///Tool
#import "XPMacro.h"
#import "ThemeColor+UserCard.h"
#import "TTPopup.h"
#import "XPHtmlUrl.h"
#import "AccountInfoStorage.h"
#import "SpriteSheetImageManager.h"
///Model
#import "UserInfoModel.h"
#import "XPUserCardItemModel.h"
@@ -50,6 +52,10 @@
@property (strong, nonatomic) UIVisualEffectView *effectView;
///
@property (nonatomic,strong) NetImageView *backImageView;
///
@property (nonatomic,strong) YYAnimatedImageView *headWearImageView;
///
@property (nonatomic, strong) SpriteSheetImageManager *manager;
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@@ -135,6 +141,7 @@
[self.userInfoView addSubview:self.backImageView];
[self.userInfoView addSubview:self.effectView];
[self.userInfoView addSubview:self.avatarImageView];
[self.userInfoView addSubview:self.headWearImageView];
[self.userInfoView addSubview:self.nickLabel];
[self.userInfoView addSubview:self.sexImageView];
[self.userInfoView addSubview:self.tagStackView];
@@ -207,6 +214,12 @@
make.top.mas_equalTo(self.userInfoView).offset(30);
}];
[self.headWearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.center.mas_equalTo(self.avatarImageView);
make.width.mas_equalTo(self.avatarImageView.mas_width).multipliedBy(1.2);
make.height.mas_equalTo(self.headWearImageView.mas_width);
}];
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.avatarImageView.mas_right).offset(5);
make.top.mas_equalTo(self.avatarImageView);
@@ -393,6 +406,18 @@
self.namePlateView.hidden = YES;
}
self.idLabel.text = [NSString stringWithFormat:@"音游号:%ld", userInfo.erbanNo];
NSString * headwearUrl= userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic;
self.headWearImageView.hidden = headwearUrl.length <= 0;
if (headwearUrl.length > 0) {
NSURL *url = [NSURL URLWithString:headwearUrl];
@kWeakify(self);
[self.manager loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
@kStrongify(self);
self.headWearImageView.image = sprit;
} failureBlock:^(NSError * _Nullable error) {
}];
}
}
- (void)onGetFunctionArraySccess:(NSArray<XPUserCardItemModel *> *)array {
@@ -902,5 +927,20 @@
return _operaStackView;
}
- (SpriteSheetImageManager *)manager {
if (!_manager) {
_manager = [[SpriteSheetImageManager alloc] init];
}
return _manager;
}
- (YYAnimatedImageView *)headWearImageView {
if (!_headWearImageView) {
_headWearImageView = [[YYAnimatedImageView alloc] init];
_headWearImageView.backgroundColor = [UIColor clearColor];
_headWearImageView.contentMode = UIViewContentModeScaleAspectFit;
}
return _headWearImageView;
}
@end

View File

@@ -296,7 +296,7 @@
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
request.key = position;
request.value = [userInfo toJSONString];
request.value = [[self configUpdateChatRoomQueueExt:userInfo] toJSONString];
request.roomId = roomId;
request.transient = YES;
@@ -316,7 +316,18 @@
}
}
- (NSDictionary *)configUpdateChatRoomQueueExt:(UserInfoModel *)userInfo {
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
[dic setValue:@(userInfo.gender) forKey:@"gender"];
[dic setValue:userInfo.avatar forKey:@"avatar"];
[dic setValue:@(userInfo.uid) forKey:@"uid"];
[dic setValue:userInfo.nick forKey:@"nick"];
NSString * headWearUrl = userInfo.headwearEffect.length > 0 ? userInfo.headwearEffect : userInfo.headwearPic;
if (headWearUrl.length > 0) {
[dic setValue:headWearUrl forKey:@"headWearUrl"];
}
return dic;
}
#pragma mark - Event Response
- (void)closeButtonAction:(UIButton *)sender {

View File

@@ -305,7 +305,8 @@
}
self.roomInfo.onlineNum = onLineNumber;
[self.roomHeaderView onRoomUpdate];
[self.stageView handleNIMNotificationMessage:content];
[self.stageView handleNIMNotificationMessage:message];
[self.animationView handleNIMNotificationMessage:message];
} else if (message.messageType == NIMMessageTypeCustom) {
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.