小喇叭展示
This commit is contained in:
@@ -130,6 +130,7 @@
|
||||
9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; };
|
||||
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
|
||||
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
|
||||
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
|
||||
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
|
||||
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; };
|
||||
9B73CD05279A9A6A006AF255 /* XPSkillCardSaveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B73CD04279A9A6A006AF255 /* XPSkillCardSaveModel.m */; };
|
||||
@@ -797,6 +798,8 @@
|
||||
9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardViewController.m; sourceTree = "<group>"; };
|
||||
9B33E3D227D8A1A4003B0E62 /* XPSkillCardPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardPlayerManager.h; sourceTree = "<group>"; };
|
||||
9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; };
|
||||
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
|
||||
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
|
||||
9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
|
||||
9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+RoomTrumpet.m"; sourceTree = "<group>"; };
|
||||
9B5BF8A927E1BF45005DD346 /* XPRoomTrumpetProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetProtocol.h; sourceTree = "<group>"; };
|
||||
@@ -2609,6 +2612,8 @@
|
||||
children = (
|
||||
9B16A34627E17D9B00E13A98 /* XPRoomTrumpetViewController.h */,
|
||||
9B16A34727E17D9B00E13A98 /* XPRoomTrumpetViewController.m */,
|
||||
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */,
|
||||
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
@@ -4792,6 +4797,7 @@
|
||||
E81366F826F0C12A0076364C /* LoginFullInfoProtocol.h in Sources */,
|
||||
9BBC028E2786FA060007C24B /* NobleCardModel.m in Sources */,
|
||||
E8E70D7E26F2F19D00F03460 /* Api+Mine.m in Sources */,
|
||||
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */,
|
||||
E8E5E19427C36BA600F457D8 /* XPHomeBannerTableViewCell.m in Sources */,
|
||||
9BD9A18727A120FD004186FE /* XPMineVisitorUnReadModel.m in Sources */,
|
||||
E824543D26F58C3A00BE8163 /* XPLoginBindSuccessView.m in Sources */,
|
||||
|
22
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/Contents.json
vendored
Normal file
22
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/Contents.json
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "rooom_trumpet_bgImage@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "rooom_trumpet_bgImage@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
BIN
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/rooom_trumpet_bgImage@2x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/rooom_trumpet_bgImage@2x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.0 KiB |
BIN
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/rooom_trumpet_bgImage@3x.png
vendored
Normal file
BIN
xplan-ios/Assets.xcassets/Room/Trumpet/rooom_trumpet_bgImage.imageset/rooom_trumpet_bgImage@3x.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
@@ -27,6 +27,7 @@
|
||||
#import "XPRoomMessageTableViewCell.h"
|
||||
#import "XPRoomMessageHeaderView.h"
|
||||
#import "View/XPRoomMessageHeaderView.h"
|
||||
#import "XPRoomTrumpetView.h"
|
||||
|
||||
NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
|
||||
@@ -50,6 +51,10 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
@property (nonatomic,strong) NSMutableArray<NIMMessage *> *incomingMessages;
|
||||
///messageView 持有这个工具类 进行数据的分发操作 TODO: 有需要在改
|
||||
@property (nonatomic,strong) XPRoomMessageParser *messageParser;
|
||||
///小喇叭
|
||||
@property (nonatomic, strong) XPRoomTrumpetView *trumpetView;
|
||||
///小喇叭队列
|
||||
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
|
||||
@end
|
||||
|
||||
|
||||
@@ -82,6 +87,7 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
[self addSubview:self.messageTableView];
|
||||
[self addSubview:self.messageTipsBtn];
|
||||
self.messageTableView.tableHeaderView = self.headerView;
|
||||
[self addSubview:self.trumpetView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -96,6 +102,12 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
make.bottom.mas_equalTo(self.mas_bottom).offset(-5);
|
||||
make.left.mas_equalTo(self);
|
||||
}];
|
||||
[self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self);
|
||||
make.left.mas_equalTo(15);
|
||||
make.right.mas_equalTo(0);
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
}
|
||||
|
||||
///是否是当前房间
|
||||
@@ -323,6 +335,13 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
[[XPRoomMiniManager shareManager] resetLocalMessage];
|
||||
[self addRoomMessage:message];
|
||||
return;
|
||||
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
|
||||
if (self.trumpetView.isHidden) {
|
||||
self.trumpetView.hidden = NO;
|
||||
}
|
||||
[self.trumpetQueue addObject:attachment.data];
|
||||
self.trumpetView.data = attachment.data;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (self.hostDelegate.getRoomInfo.isCloseScreen) {
|
||||
@@ -522,4 +541,19 @@ NSString * const kRoomShowTopicKey = @"kRoomShowTopicKey";
|
||||
return _messageParser;
|
||||
}
|
||||
|
||||
- (XPRoomTrumpetView *)trumpetView {
|
||||
if (!_trumpetView) {
|
||||
_trumpetView = [[XPRoomTrumpetView alloc] init];
|
||||
_trumpetView.hidden = YES;
|
||||
}
|
||||
return _trumpetView;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)trumpetQueue {
|
||||
if (!_trumpetQueue) {
|
||||
_trumpetQueue = [NSMutableArray array];
|
||||
}
|
||||
return _trumpetQueue;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPRoomTrumpetView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/3/18.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPRoomTrumpetView : UIView
|
||||
|
||||
@property (nonatomic, strong) NSDictionary *data;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
153
xplan-ios/Main/Room/View/NobleTrumpet/View/XPRoomTrumpetView.m
Normal file
153
xplan-ios/Main/Room/View/NobleTrumpet/View/XPRoomTrumpetView.m
Normal file
@@ -0,0 +1,153 @@
|
||||
//
|
||||
// XPRoomTrumpetView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/3/18.
|
||||
//
|
||||
|
||||
#import "XPRoomTrumpetView.h"
|
||||
#import "NetImageView.h"
|
||||
///tool
|
||||
#import "ThemeColor.h"
|
||||
#import "ThemeColor+NobleCenter.h"
|
||||
#import "XPMacro.h"
|
||||
#import "XCHUDTool.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
|
||||
@interface XPRoomTrumpetView()
|
||||
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *backView;
|
||||
///头像
|
||||
@property (nonatomic,strong) NetImageView *avatarImageView;
|
||||
///贵族勋章
|
||||
@property (nonatomic,strong) NetImageView *nobleImageView;
|
||||
///昵称
|
||||
@property (nonatomic, strong) UILabel *nickLabel;
|
||||
///内容
|
||||
@property (nonatomic, strong) UILabel *contentLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPRoomTrumpetView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initContraints];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backView];
|
||||
[self addSubview:self.avatarImageView];
|
||||
[self addSubview:self.nobleImageView];
|
||||
[self addSubview:self.nickLabel];
|
||||
[self addSubview:self.contentLabel];
|
||||
}
|
||||
|
||||
- (void)initContraints {
|
||||
[self.backView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.edges.mas_equalTo(0);
|
||||
}];
|
||||
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(8);
|
||||
make.width.height.mas_equalTo(24);
|
||||
make.centerY.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.nobleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(4);
|
||||
make.width.height.mas_equalTo(20);
|
||||
make.centerY.mas_equalTo(self);
|
||||
}];
|
||||
|
||||
[self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nobleImageView.mas_right).mas_offset(2);
|
||||
make.centerY.mas_equalTo(self);
|
||||
make.width.mas_greaterThanOrEqualTo(40).priority(500);
|
||||
}];
|
||||
// 水平方向别扯我
|
||||
[self.nickLabel setContentHuggingPriority:UILayoutPriorityDefaultHigh forAxis:UILayoutConstraintAxisHorizontal];
|
||||
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nickLabel.mas_right).mas_offset(2);
|
||||
make.right.mas_equalTo(0);
|
||||
make.centerY.mas_equalTo(self);
|
||||
}];
|
||||
[self.contentLabel setContentCompressionResistancePriority:UILayoutPriorityDefaultLow forAxis:UILayoutConstraintAxisHorizontal];
|
||||
}
|
||||
|
||||
- (void)setData:(NSDictionary *)data {
|
||||
_data = data;
|
||||
self.avatarImageView.imageUrl = data[@"avatar"];
|
||||
self.nobleImageView.imageUrl = data[@"vipIcon"];
|
||||
NSString *nickStr = data[@"nick"];
|
||||
if (nickStr.length > 10) {
|
||||
nickStr = [NSString stringWithFormat:@"%@…", [nickStr substringToIndex:5]];
|
||||
} else {
|
||||
nickStr = [NSString stringWithFormat:@"%@:", nickStr];
|
||||
}
|
||||
self.nickLabel.text = nickStr;
|
||||
self.contentLabel.text = data[@"content"];
|
||||
[self layoutIfNeeded];
|
||||
}
|
||||
|
||||
#pragma mark - getter
|
||||
- (UIImageView *)backView {
|
||||
if (!_backView) {
|
||||
_backView = [[UIImageView alloc] init];
|
||||
_backView.userInteractionEnabled = YES;
|
||||
_backView.image = [UIImage imageNamed:@"rooom_trumpet_bgImage"];
|
||||
_backView.contentMode = UIViewContentModeTopLeft;
|
||||
}
|
||||
return _backView;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig *config = [[NetImageConfig alloc] init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
_avatarImageView.layer.cornerRadius = 12;
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)nobleImageView {
|
||||
if (!_nobleImageView) {
|
||||
NetImageConfig *config = [[NetImageConfig alloc] init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
_nobleImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_nobleImageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
}
|
||||
return _nobleImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)nickLabel {
|
||||
if (!_nickLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:12];
|
||||
label.textColor = [ThemeColor hightNobleLightTextColor];
|
||||
[label sizeToFit];
|
||||
_nickLabel = label;
|
||||
}
|
||||
return _nickLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)contentLabel {
|
||||
if (!_contentLabel) {
|
||||
UILabel *label = [[UILabel alloc] init];
|
||||
label.font = [UIFont systemFontOfSize:12];
|
||||
label.textColor = [ThemeColor appCellBackgroundColor];
|
||||
label.textAlignment = NSTextAlignmentLeft;
|
||||
_contentLabel = label;
|
||||
}
|
||||
return _contentLabel;
|
||||
}
|
||||
|
||||
@end
|
Reference in New Issue
Block a user