Ver Fonte

红包提醒Cell 暂时提交

SuperC há 1 ano atrás
pai
commit
fba3cf5c52

BIN
MiMoLive/MiMoLive.xcworkspace/xcuserdata/yanxuyao.xcuserdatad/UserInterfaceState.xcuserstate


+ 9 - 0
MiMoLive/MiMoLive/Classes/Live/MOShowLiveVC.m

@@ -4123,7 +4123,16 @@ static int mainRTMJoinNum = 0;
                 //所有频道横幅 - 由于消息结构体 更改 - 4 包含了5/6 类型的消息, 所以不再处理5/6 类型的消息
                 
                 if(jsonEntity.redRainPeriodId.length != 0){
+                    
                     [self.liveView showRedRainTipViewWith:entity];
+                    
+                    MORtmEntity *redTipRtm = [entity yy_modelCopy];
+                    redTipRtm.type = SystemTipRedRain;
+                    CGSize size = CGSizeMake(230.0, 38.0);
+                    redTipRtm.cellHeight = MAX(size.height + 1.0, MOTextLabelMinHeight);
+                    redTipRtm.contentWidth = 230.0;
+                    //文本消息
+                    [self toAddRtmMsgWith:redTipRtm];
                 }
                 
                 [self toPlaySuperLucky];

+ 2 - 1
MiMoLive/MiMoLive/Classes/Live/Model/RTMMessageModel/MORtmEntity.h

@@ -61,7 +61,8 @@ typedef enum : NSUInteger {
     SystemTipChat = 10003,     //聊天提示
     SystemTipGift = 10004,     //送礼提示
     SystemTipGetRed = 10005,     //领取红包提示
-    SystemTipNormalBlue = 10006  //通用蓝色提示
+    SystemTipNormalBlue = 10006,  //通用蓝色提示
+    SystemTipRedRain = 10007,  //红包雨提示
 }MORtmContentType;
 
 @interface MORtmFanBean : NSObject

+ 11 - 0
MiMoLive/MiMoLive/Classes/Live/View/LiveingView/MOShowRoomLiveView.m

@@ -14,6 +14,7 @@
 
 #import "MOLiveMsgSystemTipCell.h"
 #import "MOLiveMsgNormalTipCell.h"
+#import "MORedRainTipCell.h"
 
 #import "TYCyclePagerView.h"
 #import "MOBaseBannerCell.h"
@@ -1451,6 +1452,16 @@ static int theLikeComboNum = 0;
             baseCell = cell;
         }
             break;
+        case SystemTipRedRain:
+        {
+            MORedRainTipCell *cell = [tableView dequeueReusableCellWithIdentifier:MORedRainTipCell_ID];
+            if (cell == nil){
+                cell = [[MORedRainTipCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MORedRainTipCell_ID];
+            }
+            cell.cellModel = entity;
+            baseCell = cell;
+        }
+            break;
             
             
         default:

+ 2 - 0
MiMoLive/MiMoLive/Classes/Live/View/MsgShowView/MORedRainTipCell.h

@@ -5,6 +5,8 @@
 //  Created by SuperC on 2024/10/29.
 //
 
+#define MORedRainTipCell_ID @"MORedRainTipCell_ID"    //复用id
+
 #import <UIKit/UIKit.h>
 
 NS_ASSUME_NONNULL_BEGIN

+ 55 - 10
MiMoLive/MiMoLive/Classes/Live/View/MsgShowView/MORedRainTipCell.m

@@ -42,19 +42,21 @@
     
     [self.bgView addSubview:self.bubbleImgView];
     [self.bubbleImgView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(self.bgView).offset(-MOBgViewOffSet);
-        make.right.equalTo(self.bgView).offset(MOBgViewOffSet);
-        make.top.equalTo(self.bgView).offset(-MOBgViewOffSet);
-        make.bottom.equalTo(self.bgView).offset(MOBgViewOffSet);
+        make.left.equalTo(self.bgView).offset(-0.0);
+        make.right.equalTo(self.bgView).offset(0.0);
+        make.top.equalTo(self.bgView).offset(-0.0);
+        make.bottom.equalTo(self.bgView).offset(0.0);
         
     }];
+    self.bubbleImgView.layer.cornerRadius = 14.0;
+    self.bubbleImgView.layer.masksToBounds = YES;
     
     [self.bgView addSubview:self.contentTextView];
     [self.contentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
-        make.left.equalTo(self.bgView).offset(MOContentLeftAndRighSpacing);
-        make.right.equalTo(self.bgView).offset(-MOContentLeftAndRighSpacing);
-        make.centerY.equalTo(self.bgView);
-        make.height.equalTo(@16.0);
+        make.left.equalTo(self.redTagImgView.mas_right).offset(2.0);
+        make.right.equalTo(self.bgView).offset(-2.0);
+        make.top.equalTo(self.bgView).offset(5.0);
+        make.bottom.equalTo(self.bgView);
     }];
 }
 
@@ -72,10 +74,53 @@
 - (void)setCellModel:(MORtmEntity *)cellModel{
     _cellModel = cellModel;
     
-    NSMutableAttributedString *attributedString = [MOTextTools creteTextWith:cellModel];
+    MORtmJosnEntity *jsonEntity = (MORtmJosnEntity *)cellModel.data;
+    NSString *userName = jsonEntity.activitySuperLucky2.user.username;
+    
+    NSString *luckyTipStr = @"Super Lucky Jackpot";
+    NSString *redRainTipStr = @"Red Envelope Rain";
+    
+    NSString *endText = [NSString stringWithFormat:@"%@ Win %@ %@ is coming...",userName,luckyTipStr,redRainTipStr];
+    
+    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:endText attributes:@{NSForegroundColorAttributeName:[MOTools colorWithHexString:@"#FFFFFF" alpha:1.0]}];
+
+    [self base_yellow_colorfulStringWith:endText AndNameStr:userName And:attributedString];
+    [self base_blue_colorfulStringWith:endText AndNameStr:luckyTipStr And:attributedString];
+    [self base_yellow_colorfulStringWith:endText AndNameStr:redRainTipStr And:attributedString];
+    
+    // 设置字体大小的属性
+    [attributedString addAttribute:NSFontAttributeName value:[MOTextTools getTheFontWithSize:12.0 AndFontName:@"Akrobat"] range:NSMakeRange(0, endText.length)];
+    
     self.contentTextView.attributedText = attributedString;
     
+}
+
+- (NSMutableAttributedString *)base_yellow_colorfulStringWith:(NSString *)contentStr AndNameStr:(NSString *)nameStr And:(NSMutableAttributedString *)attributedString {
+    
+    // 创建属性字符串,整体颜色为白色
+    if(nameStr.length != 0){
+        NSRange redRange = [contentStr rangeOfString:nameStr];
+        if(redRange.location != NSNotFound){
+            // 将最后三个字符的颜色设置为红色
+            [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#FFF391" alpha:1.0] range:redRange];
+        }
+    }
+    
+    return attributedString;
+}
+
+- (NSMutableAttributedString *)base_blue_colorfulStringWith:(NSString *)contentStr AndNameStr:(NSString *)nameStr And:(NSMutableAttributedString *)attributedString {
+    
+    // 创建属性字符串,整体颜色为白色
+    if(nameStr.length != 0){
+        NSRange redRange = [contentStr rangeOfString:nameStr];
+        if(redRange.location != NSNotFound){
+            // 将最后三个字符的颜色设置为红色
+            [attributedString addAttribute:NSForegroundColorAttributeName value:[MOTools colorWithHexString:@"#67EBFF" alpha:1.0] range:redRange];
+        }
+    }
     
+    return attributedString;
 }
 
 #pragma mark - Lazy
@@ -84,7 +129,7 @@
     if (_bgView == nil)
     {
         _bgView = [UIView new];
-        _bgView.backgroundColor = MONormalBgViewColor;
+        _bgView.backgroundColor = [UIColor clearColor];
     }
     return _bgView;
 }