最后提交

This commit is contained in:
启星
2025-10-27 17:05:46 +08:00
parent 92de736c3f
commit 3f76f23cb0
19 changed files with 201 additions and 32 deletions

View File

@@ -37,6 +37,8 @@
#import "QXRedBagRecordViewController.h"
#import "QXRoomEmojiView.h"
#import "QXGiftDisplayManager.h"
#import "QXRoomDayTaskTagView.h"
#import "QXTaskViewController.h"
@interface QXRoomViewController ()<
QXRoomBottomViewDelegate,
@@ -85,6 +87,7 @@ QXRoomUserInfoViewDelegate
@property (nonatomic,strong)QXAllRoomHourRankTagView *hourRankIconView;
@property (nonatomic,strong)QXRoomEmojiView *emojiView;
@property (nonatomic,strong)QXRoomDayTaskTagView *dayTaskTagView;
@end
@implementation QXRoomViewController
@@ -177,14 +180,14 @@ QXRoomUserInfoViewDelegate
[self.upSeatBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(-16);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(56), ScaleWidth(27)));
make.bottom.equalTo(self.bottomView.mas_top).offset(-34);
make.bottom.equalTo(self.bottomView.mas_top).offset(-18);
}];
self.soundBtn.hidden = YES;
[self.view addSubview:self.soundBtn];
[self.soundBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.upSeatBtn);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(52), ScaleWidth(52)));
make.size.mas_equalTo(CGSizeMake(ScaleWidth(52), ScaleWidth(25)));
make.bottom.equalTo(self.upSeatBtn.mas_top).offset(-12);
}];
@@ -217,6 +220,7 @@ QXRoomUserInfoViewDelegate
[self.view addSubview:self.hourRankIconView];
[self.view addSubview:self.redBagTagView];
[self.view addSubview:self.dayTaskTagView];
[self setupEffectView];
// [self.view addSubview:self.headlineView];
@@ -812,6 +816,7 @@ QXRoomUserInfoViewDelegate
if (toPitNumber == 9) {
self.soundBtn.hidden = NO;
self.titleView.isCompere = YES;
self.seatContentView.myPitNumber = toPitNumber;
}else{
self.soundBtn.hidden = YES;
self.titleView.isCompere = NO;
@@ -2004,5 +2009,16 @@ QXRoomUserInfoViewDelegate
}
return _emojiView;
}
-(QXRoomDayTaskTagView *)dayTaskTagView{
if (!_dayTaskTagView) {
_dayTaskTagView = [[QXRoomDayTaskTagView alloc] init];
MJWeakSelf
_dayTaskTagView.startBlock = ^{
QXTaskViewController *vc = [[QXTaskViewController alloc] init];
[weakSelf.navigationController pushViewController:vc animated:YES];
};
}
return _dayTaskTagView;
}
@end

View File

@@ -11,7 +11,8 @@
#import "QXBadgeButton.h"
#import "AppDelegate.h"
@interface QXRoomBottomView()<QXDynamicCommentInputViewDelegate>
@interface QXRoomBottomView()<QXDynamicCommentInputViewDelegate,UIGestureRecognizerDelegate>
@property (nonatomic,strong)UIView *inputBigBgView;
@property (nonatomic,strong)UIView *sayBg;
@property (nonatomic,strong)UIButton *emojiBtn;
@property (nonatomic,strong)UIButton *chatBtn;
@@ -405,6 +406,10 @@
}
-(void)didResignFirstResponder{
self.redpacketModel = nil;
[self.inputBigBgView removeFromSuperview];
}
-(void)didBecomeFirstResponder{
[self.vc.view insertSubview:self.inputBigBgView belowSubview:self.commentView];
}
-(QXDynamicCommentInputView *)commentView{
if (!_commentView) {
@@ -413,4 +418,20 @@
}
return _commentView;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch{
return touch.view == self.inputBigBgView;
}
-(void)hideInput{
[self.commentView.textField resignFirstResponder];
}
-(UIView *)inputBigBgView{
if (!_inputBigBgView) {
_inputBigBgView = [[UIView alloc] initWithFrame:UIScreen.mainScreen.bounds];
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideInput)];
tap.delegate = self;
[_inputBigBgView addGestureRecognizer:tap];
}
return _inputBigBgView;
}
@end

View File

@@ -11,7 +11,7 @@
#define messageNameColor RGB16(0x00C8FF)
#define messageGiftColor RGB16(0xFFE309)
#define messageBubbleColor RGB16A(0x000000, 0.3)
#define messageBubbleMargin 4
#define messageBubbleMargin 2
NSArray<NSValue *> *findAllOccurrencesOfString(NSString *fullString, NSString *substring) {
NSMutableArray<NSValue *> *occurrences = [NSMutableArray array];
NSRange searchRange = NSMakeRange(0, fullString.length);
@@ -316,13 +316,7 @@ NSInteger maxMessageCount = 20;
height = 28+19+13+8 + height;
}
}else if (model.messageType == QXRoomChatMessageTypeGift) {
// if ([model.FromUserInfo.chat_bubble isExist]) {
// height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16*2-8];
// height = 16*2 + height+1;
// }else{
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16*2-8];
height = 8*2+messageBubbleMargin*2 + height+1;
// }
height = [model.text heightForFont:[UIFont systemFontOfSize:12] width:ScaleWidth(280)-16-8-8*2] + 12+4+1;
}else if(model.messageType == QXRoomChatMessageTypeEmoji){
if ([model.FromUserInfo.chat_bubble isExist]) {
height = 28+19+13+16 + 40;
@@ -330,7 +324,7 @@ NSInteger maxMessageCount = 20;
height = 28+19+13+8 + 40;
}
}else{
height = [model.text heightForFont:[UIFont systemFontOfSize:14] width:ScaleWidth(280)-16-8-8*2] + 12+16+1;
height = [model.text heightForFont:[UIFont systemFontOfSize:12] width:ScaleWidth(280)-16-8-8*2] + 12+4+1;
}
return height;
@@ -487,6 +481,7 @@ NSInteger maxMessageCount = 20;
-(void)initSubviews{
self.bgView = [[UIView alloc] init];
[self.contentView addSubview:self.bgView];
[self.bgView addRoundedCornersWithRadius:8];
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(0);
@@ -501,7 +496,9 @@ NSInteger maxMessageCount = 20;
self.bubbleImageView.backgroundColor = messageBubbleColor;
[self.bgView addSubview:self.bubbleImageView];
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bgView);
make.left.right.equalTo(self.bgView);
make.top.mas_equalTo(-4);
make.bottom.mas_equalTo(4);
}];
self.headerImageView = [[UIImageView alloc] init];
@@ -601,7 +598,7 @@ NSInteger maxMessageCount = 20;
make.top.mas_equalTo(19);
}];
}else{
self.bgView.backgroundColor = UIColor.clearColor;
self.bgView.backgroundColor = messageBubbleColor;
[self.bgView mas_updateConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(16);
make.right.mas_equalTo(-8);
@@ -613,7 +610,7 @@ NSInteger maxMessageCount = 20;
make.top.mas_equalTo(11);
}];
self.bubbleImageView.image = nil;
self.bubbleImageView.backgroundColor = messageBubbleColor;
self.bubbleImageView.backgroundColor = UIColor.clearColor;
}
}
-(NSMutableArray *)iconViewArray{
@@ -758,7 +755,7 @@ NSInteger maxMessageCount = 20;
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.font = [UIFont systemFontOfSize:12];
self.titleLabel.numberOfLines = 0;
[self.bgView addSubview:self.titleLabel];
// [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -768,8 +765,8 @@ NSInteger maxMessageCount = 20;
// }];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bgView).offset(8);
make.top.mas_equalTo(8);
make.bottom.mas_equalTo(-8);
make.top.mas_equalTo(2);
make.bottom.mas_equalTo(-2);
make.right.mas_equalTo(-8);
}];
@@ -806,6 +803,10 @@ NSInteger maxMessageCount = 20;
// [self.iconViewArray addObject:iconImageView];
// }
}
-(void)layoutSubviews{
[super layoutSubviews];
[self.bgView addRoundedCornersWithRadius:self.bgView.height/2];
}
-(void)loadBubble{
// if ([self.message.FromUserInfo.chat_bubble isExist]) {
@@ -937,7 +938,9 @@ NSInteger maxMessageCount = 20;
self.bubbleImageView.backgroundColor = messageBubbleColor;
[self.bgView addSubview:self.bubbleImageView];
[self.bubbleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.bgView);
make.left.right.equalTo(self.bgView);
make.top.mas_equalTo(-4);
make.bottom.mas_equalTo(4);
}];
self.headerImageView = [[UIImageView alloc] init];
@@ -1077,7 +1080,14 @@ NSInteger maxMessageCount = 20;
}
return self;
}
-(void)layoutSubviews{
[super layoutSubviews];
if (self.message.messageType == QXRoomChatMessageTypeNotice) {
[self.bgView addRoundedCornersWithRadius:8];
}else{
[self.bgView addRoundedCornersWithRadius:self.bgView.height/2];
}
}
-(void)setMessage:(QXRoomChatListModel *)message{
_message = message;
NSMutableAttributedString *attr = [[NSMutableAttributedString alloc] initWithString:message.text];
@@ -1115,7 +1125,7 @@ NSInteger maxMessageCount = 20;
}
}
if (message.messageType == QXRoomChatMessageTypeNotice) {
[attr yy_setColor:messageNameColor range:NSMakeRange(0, attr.length)];
[attr yy_setColor:messageNoticeColor range:NSMakeRange(0, attr.length)];
}
self.titleLabel.attributedText = attr;
}
@@ -1136,13 +1146,13 @@ NSInteger maxMessageCount = 20;
self.titleLabel = [[UILabel alloc] init];
// self.titleLabel.textColor = RGB16(0XD1A9FE);
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont systemFontOfSize:14];
self.titleLabel.font = [UIFont systemFontOfSize:12];
self.titleLabel.numberOfLines = 0;
[self.bgView addSubview:self.titleLabel];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self.bgView).offset(8);
make.top.mas_equalTo(8);
make.bottom.mas_equalTo(-8);
make.top.mas_equalTo(2);
make.bottom.mas_equalTo(-2);
make.right.mas_equalTo(-8);
}];
}

View File

@@ -0,0 +1,16 @@
//
// QXRoomDayTaskTagView.h
// QXLive
//
// Created by 启星 on 2025/10/27.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXRoomDayTaskTagView : UIView
@property (nonatomic,copy)void(^startBlock)(void);
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,64 @@
//
// QXRoomDayTaskTagView.m
// QXLive
//
// Created by on 2025/10/27.
//
#import "QXRoomDayTaskTagView.h"
@interface QXRoomDayTaskTagView()
@property (nonatomic,strong)UIImageView *imageView;
@property (nonatomic,strong)UILabel *timeLabel;
@property (nonatomic,strong)UIButton *btn;
@end
@implementation QXRoomDayTaskTagView
- (instancetype)init
{
self = [super init];
if (self) {
self.frame = CGRectMake(SCREEN_WIDTH-80, SCREEN_HEIGHT-330, 80, 60);
[self initSubviews];
}
return self;
}
-(void)initSubviews{
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"room_day_task"]];
self.imageView.frame = CGRectMake(0, 0, 80, 60);
[self addSubview:self.imageView];
self.timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, self.imageView.bottom, self.width, 20)];
self.timeLabel.textAlignment = NSTextAlignmentCenter;
self.timeLabel.font = [UIFont systemFontOfSize:12];
self.timeLabel.textColor = RGB16(0xFFEBBD);
[self addSubview:self.timeLabel];
self.btn = [[UIButton alloc] initWithFrame:self.bounds];
[self.btn addTarget:self action:@selector(btnClick) forControlEvents:(UIControlEventTouchUpInside)];
[self addSubview:self.btn];
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
[self addGestureRecognizer:panRecognizer];
}
-(void)btnClick{
if (self.startBlock) {
self.startBlock();
}
}
-(void)handlePan:(UIPanGestureRecognizer*)recognizer{
if (recognizer.state == UIGestureRecognizerStateEnded) {
NSLog(@"拖动结束");
}
CGPoint translation = [recognizer translationInView:self.viewController.view];
CGPoint panCenter = CGPointMake(recognizer.view.center.x + translation.x,
recognizer.view.center.y + translation.y);
if (panCenter.y < kSafeAreaTop || panCenter.y> SCREEN_HEIGHT-kSafeAreaBottom) {
return;
}
recognizer.view.center = CGPointMake(SCREEN_WIDTH-ScaleWidth(80)/2,
recognizer.view.center.y + translation.y);
[recognizer setTranslation:CGPointZero inView:self.viewController.view];
}
@end

View File

@@ -40,10 +40,10 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="王富贵" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SNA-M2-7Y8">
<rect key="frame" x="74" y="85.666666666666671" width="90" height="18"/>
<rect key="frame" x="74" y="85.666666666666671" width="200" height="18"/>
<constraints>
<constraint firstAttribute="height" constant="18" id="XKi-Bc-Kyd"/>
<constraint firstAttribute="width" constant="90" id="cZF-LW-Eez"/>
<constraint firstAttribute="width" constant="200" id="cZF-LW-Eez"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="calibratedRGB"/>
@@ -84,7 +84,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wAY-Bl-81T">
<rect key="frame" x="174" y="94.666666666666671" width="169" height="0.0"/>
<rect key="frame" x="284" y="94.666666666666671" width="59" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="12"/>
<color key="textColor" red="0.59999999999999998" green="0.59999999999999998" blue="0.59999999999999998" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>