This commit is contained in:
liyuhua
2023-10-24 10:48:57 +08:00
parent 2632666cc3
commit 09d2c0f49d
66 changed files with 390 additions and 515 deletions

View File

@@ -0,0 +1,24 @@
//
// PIRoomGiftBroadcastWindow.h
// YuMi
//
// Created by duoban on 2023/10/23.
//
#import <UIKit/UIKit.h>
@protocol PIRoomGiftBroadcastWindowDelegate <NSObject>
-(void)confirmLeaveForTheRoom:(NSString *_Nonnull)roodUid;
@end
NS_ASSUME_NONNULL_BEGIN
@interface PIRoomGiftBroadcastWindow : UIView
@property(nonatomic,copy) NSString *roomName;
@property(nonatomic,copy) NSString *roodUid;
@property(nonatomic,weak) id<PIRoomGiftBroadcastWindowDelegate>delegate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,174 @@
//
// PIRoomGiftBroadcastWindow.m
// YuMi
//
// Created by duoban on 2023/10/23.
//
#import "PIRoomGiftBroadcastWindow.h"
@interface PIRoomGiftBroadcastWindow ()
///
@property(nonatomic,strong) UIView *bgView;
///
@property(nonatomic,strong) UILabel *titleView;
///
@property(nonatomic,strong) UILabel *pi_tipsView;
///
@property(nonatomic,strong) UILabel *roomNameView;
///
@property(nonatomic,strong) UIButton *pi_selectView;
///
@property(nonatomic,strong) UILabel *pi_selectTipsView;
///
@property(nonatomic,strong) UIButton *pi_cancelBtn;
///
@property(nonatomic,strong) UIButton *pi_confirmBtn;
@end
@implementation PIRoomGiftBroadcastWindow
-(instancetype)initWithFrame:(CGRect)frame{
self = [super initWithFrame:frame];
if(self){
[self installUI];
[self installConstraints];
}
return self;
}
-(void)installUI{
self.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
[self addSubview:self.bgView];
[self.bgView addSubview:self.titleView];
[self.bgView addSubview:self.pi_tipsView];
[self.bgView addSubview:self.roomNameView];
[self.bgView addSubview:self.pi_selectView];
[self.bgView addSubview:self.pi_selectTipsView];
[self.bgView addSubview:self.pi_cancelBtn];
[self.bgView addSubview:self.pi_confirmBtn];
}
-(void)installConstraints{
[self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(319));
make.height.mas_equalTo(kGetScaleWidth(230));
make.center.equalTo(self);
}];
[self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(24));
make.centerX.equalTo(self.bgView);
make.height.mas_equalTo(kGetScaleWidth(20));
}];
[self.pi_tipsView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(68));
make.centerX.equalTo(self.bgView);
make.height.mas_equalTo(kGetScaleWidth(20));
}];
[self.roomNameView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(kGetScaleWidth(90));
make.leading.trailing.equalTo(self.bgView).inset(kGetScaleWidth(10));
make.height.mas_equalTo(kGetScaleWidth(20));
}];
[self.pi_selectTipsView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.bgView.mas_centerX).mas_equalTo(kGetScaleWidth(9));
make.top.mas_equalTo(kGetScaleWidth(124));
make.height.mas_equalTo(kGetScaleWidth(20));
}];
[self.pi_selectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(14));
make.trailing.equalTo(self.pi_selectTipsView.mas_leading).mas_offset(-kGetScaleWidth(4));
make.centerY.equalTo(self.pi_selectTipsView);
}];
[self.pi_cancelBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(124));
make.height.mas_equalTo(kGetScaleWidth(42));
make.top.mas_equalTo(kGetScaleWidth(164));
make.leading.mas_equalTo(kGetScaleWidth(28));
}];
[self.pi_confirmBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(124));
make.height.mas_equalTo(kGetScaleWidth(42));
make.top.mas_equalTo(kGetScaleWidth(164));
make.trailing.mas_equalTo(-kGetScaleWidth(28));
}];
}
-(void)pi_cancelAction{
[self removeFromSuperview];
}
-(void)piConfirmAction{
if(self.delegate && [self.delegate respondsToSelector:@selector(confirmLeaveForTheRoom:)]){
[self.delegate confirmLeaveForTheRoom:self.roodUid];
}
}
#pragma mark -
- (UIView *)bgView{
if(!_bgView){
_bgView = [UIView new];
_bgView.backgroundColor = [UIColor whiteColor];
[_bgView setCornerWithLeftTopCorner:kGetScaleWidth(20) rightTopCorner:kGetScaleWidth(20) bottomLeftCorner:kGetScaleWidth(20) bottomRightCorner:kGetScaleWidth(20) size:CGSizeMake(kGetScaleWidth(319), kGetScaleWidth(230))];
}
return _bgView;
}
- (UILabel *)titleView{
if(!_titleView){
_titleView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomGiftBroadcastWindow0") font:kFontSemibold(18) textColor:UIColorFromRGB(0x1F1B4F)];
_titleView.textAlignment = NSTextAlignmentCenter;
}
return _titleView;
}
- (UILabel *)pi_tipsView{
if(!_pi_tipsView){
_pi_tipsView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomGiftBroadcastWindow1") font:kFontRegular(14) textColor:UIColorFromRGB(0x1F1B4F)];
_pi_tipsView.textAlignment = NSTextAlignmentCenter;
}
return _pi_tipsView;
}
- (UILabel *)roomNameView{
if(!_roomNameView){
_roomNameView = [UILabel labelInitWithText:YMLocalizedString(@"“我是房间名房间名”") font:kFontRegular(14) textColor:UIColorFromRGB(0x9168FA)];
_roomNameView.textAlignment = NSTextAlignmentCenter;
}
return _roomNameView;
}
- (UIButton *)pi_selectView{
if(!_pi_selectView){
_pi_selectView = [UIButton new];
[_pi_selectView setEnlargeEdgeWithTop:10 right:10 bottom:10 left:10];
[_pi_selectView setImage:kImage(@"pi_room_gift_broadcast_window_select") forState:UIControlStateSelected];
[_pi_selectView setImage:kImage(@"pi_room_gift_broadcast_window_no_select") forState:UIControlStateNormal];
}
return _pi_selectView;
}
- (UILabel *)pi_selectTipsView{
if(!_pi_selectTipsView){
_pi_selectTipsView = [UILabel labelInitWithText:YMLocalizedString(@"PIRoomGiftBroadcastWindow2") font:kFontRegular(12) textColor:UIColorFromRGB(0xB3B3C3)];
}
return _pi_selectTipsView;
}
- (UIButton *)pi_cancelBtn{
if(!_pi_cancelBtn){
_pi_cancelBtn = [UIButton new];
_pi_cancelBtn.backgroundColor = UIColorFromRGB(0xE6E6F0);
[_pi_cancelBtn setTitle:YMLocalizedString(@"PIRoomGiftBroadcastWindow3") forState:UIControlStateNormal];
_pi_cancelBtn.titleLabel.font = kFontMedium(16);
[_pi_cancelBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_pi_cancelBtn.layer.cornerRadius = kGetScaleWidth(42)/2;
_pi_cancelBtn.layer.masksToBounds = YES;
[_pi_cancelBtn addTarget:self action:@selector(pi_cancelAction) forControlEvents:UIControlEventTouchUpInside];
}
return _pi_cancelBtn;
}
- (UIButton *)pi_confirmBtn{
if(!_pi_confirmBtn){
_pi_confirmBtn = [UIButton new];
UIImage *image = [UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor],[DJDKMIMOMColor confirmButtonGradientMiddleColor],[DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(kGetScaleWidth(124), kGetScaleWidth(42))];
[_pi_confirmBtn setBackgroundImage:image forState:UIControlStateNormal];
[_pi_confirmBtn setTitle:YMLocalizedString(@"PIRoomGiftBroadcastWindow4") forState:UIControlStateNormal];
_pi_confirmBtn.titleLabel.font = kFontMedium(16);
[_pi_confirmBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_pi_confirmBtn.layer.cornerRadius = kGetScaleWidth(42)/2;
_pi_confirmBtn.layer.masksToBounds = YES;
[_pi_confirmBtn addTarget:self action:@selector(piConfirmAction) forControlEvents:UIControlEventTouchUpInside];
}
return _pi_confirmBtn;
}
@end

View File

@@ -16,113 +16,29 @@
///View
#import "NetImageView.h"
#define kScreenScale (CGFloat)KScreenWidth / (CGFloat)375
@interface XPRoomGiftUserView : UIView
///
@property (nonatomic,strong) NetImageView *avatarImageView;
///
@property (nonatomic,strong) UIImageView *boraderImageView;
///
@property (nonatomic,strong) UIButton *nickButton;
@end
@implementation XPRoomGiftUserView
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.avatarImageView];
[self addSubview:self.boraderImageView];
[self addSubview:self.nickButton];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.nickButton.mas_bottom);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.top.mas_equalTo(self);
make.height.width.mas_equalTo(44 * kScreenScale);
}];
[self.boraderImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(51 * kScreenScale, 51 * kScreenScale));
make.center.mas_equalTo(self.avatarImageView);
}];
[self.nickButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(-8 * kScreenScale);
make.size.mas_equalTo(CGSizeMake(66 * kScreenScale, 16 * kScreenScale));
}];
}
#pragma mark - Getters And Setters
- (NetImageView *)avatarImageView {
if (!_avatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.userInteractionEnabled = YES;
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 44 * kScreenScale/2;
}
return _avatarImageView;
}
- (UIImageView *)boraderImageView {
if (!_boraderImageView) {
_boraderImageView = [[UIImageView alloc] init];
_boraderImageView.userInteractionEnabled = YES;
}
return _boraderImageView;
}
- (UIButton *)nickButton {
if (!_nickButton) {
_nickButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_nickButton setTitleColor:[DJDKMIMOMColor giftBroadcastNickColor] forState:UIControlStateNormal];
_nickButton.titleLabel.font = [UIFont systemFontOfSize:10];
[_nickButton setBackgroundImage:[UIImage imageNamed:@"room_gift_broadcast_avatar_board"] forState:UIControlStateNormal];
}
return _nickButton;
}
@end
@interface XPRoomGiftBroadcastView ()
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) XPRoomGiftUserView *sendView;
///
@property (nonatomic,strong) UIImageView *sendImageView;
///
@property (nonatomic,strong) XPRoomGiftUserView *receiveView;
///
@property(nonatomic,strong) NetImageView *senderAvatarView;
///
@property(nonatomic,strong) MarqueeLabel *pi_contentView;
///
@property (nonatomic,strong) NetImageView *giftImageView;
///
@property (nonatomic,strong) UILabel *countLabel;
///
@property (nonatomic,strong) UIButton *closeButton;
///iD
@property (nonatomic,strong) UILabel *roomIdLabel;
///
@property (nonatomic,strong) UILabel *roomNameLabel;
///
@property (nonatomic,strong) UIImageView *roomIdBgView;
@property (nonatomic,strong) UIImageView *pi_roomIconView;
///
@property(nonatomic,strong) UIButton *circuseeBtn;
@end
@implementation XPRoomGiftBroadcastView
@@ -154,14 +70,15 @@
- (void)initSubViews {
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.closeButton];
[self.backImageView addSubview:self.sendView];
[self.backImageView addSubview:self.sendImageView];
[self.backImageView addSubview:self.receiveView];
[self.backImageView addSubview:self.senderAvatarView];
[self.backImageView addSubview:self.pi_contentView];
[self.backImageView addSubview:self.pi_roomIconView];
[self.backImageView addSubview:self.roomNameLabel];
[self.backImageView addSubview:self.circuseeBtn];
[self.backImageView addSubview:self.giftImageView];
[self.backImageView addSubview:self.countLabel];
[self.backImageView addSubview:self.roomIdBgView];
[self.roomIdBgView addSubview:self.roomIdLabel];
}
@@ -169,177 +86,123 @@
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.trailing.mas_equalTo(self).inset(15);
make.top.mas_equalTo(self);
make.height.mas_equalTo(125 * kScreenScale);
make.edges.equalTo(self);
}];
[self.sendView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView).offset(-27 * kScreenScale);
make.width.mas_equalTo(66 * kScreenScale);
make.leading.mas_equalTo(self.backImageView).offset(13 * kScreenScale);
[self.senderAvatarView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(44));
make.leading.mas_equalTo(kGetScaleWidth(23));
make.centerY.equalTo(self.backImageView);
}];
[self.pi_contentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.equalTo(self.senderAvatarView.mas_trailing).mas_offset(kGetScaleWidth(13));
make.top.mas_equalTo(kGetScaleWidth(18));
make.trailing.mas_equalTo(-kGetScaleWidth(133));
make.height.mas_equalTo(kGetScaleWidth(14));
}];
[self.sendImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(30 * kScreenScale, 15 * kScreenScale));
make.centerY.mas_equalTo(self.sendView);
make.leading.mas_equalTo(self.sendView.mas_trailing).offset(13 * kScreenScale);
[self.pi_roomIconView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.height.mas_equalTo(kGetScaleWidth(12));
make.leading.equalTo(self.senderAvatarView.mas_trailing).mas_offset(kGetScaleWidth(11));
make.top.mas_equalTo(kGetScaleWidth(39));
}];
[self.roomNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(kGetScaleWidth(92));
make.top.mas_equalTo(kGetScaleWidth(40));
make.height.mas_equalTo(kGetScaleWidth(12));
make.width.mas_equalTo(kGetScaleWidth(105));
[self.receiveView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.width.mas_equalTo(self.sendView);
make.leading.mas_equalTo(self.sendImageView.mas_trailing).offset(13 * kScreenScale);
}];
[self.circuseeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(kGetScaleWidth(44));
make.height.mas_equalTo(kGetScaleWidth(20));
make.leading.equalTo(self.roomNameLabel.mas_trailing).mas_offset(kGetScaleWidth(5));
make.centerY.equalTo(self.roomNameLabel);
}];
[self.giftImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(60 * kScreenScale, 60 * kScreenScale));
make.centerY.mas_equalTo(self.sendView);
make.leading.mas_equalTo(self.receiveView.mas_trailing).offset(13 * kScreenScale);
make.size.mas_equalTo(CGSizeMake(kGetScaleWidth(64), kGetScaleWidth(64)));
make.centerY.mas_equalTo(self.backImageView);
make.trailing.mas_equalTo(-kGetScaleWidth(64));
}];
[self.countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.leading.mas_equalTo(self.giftImageView.mas_trailing).offset(13 * kScreenScale);
make.centerY.mas_equalTo(self.sendView);
make.leading.mas_equalTo(self.giftImageView.mas_trailing).offset(kGetScaleWidth(2));
make.centerY.mas_equalTo(self.backImageView);
}];
[self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.trailing.mas_equalTo(self.backImageView).offset(-3);
make.top.mas_equalTo(13);
make.size.mas_equalTo(CGSizeMake(28, 22));
}];
[self.roomIdBgView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(kGetScaleWidth(8.5));
make.width.mas_equalTo(kGetScaleWidth(88.5));
make.height.mas_equalTo(kGetScaleWidth(18));
}];
[self.roomIdLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.equalTo(self.roomIdBgView);
}];
}
- (void)initEvents {
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didClickEnterRoom)];
[self.backImageView addGestureRecognizer:tap];
[self.circuseeBtn addTarget:self action:@selector(didClickEnterRoom) forControlEvents:UIControlEventTouchUpInside];
}
- (void)updateSubviews:(BroadCastLevel)level {
UIColor * nickColor;
NSString * nickBackImageName;
UIColor * lineColor;
UIColor *bgBtnColor;
NSString * bgImageName;
NSString *closeImageName;
NSString *boraderImageName;
switch (level) {
case BroadCastLevel_Normal:
{
CGFloat kscale = (CGFloat)124/ (CGFloat)345;
CGFloat width = KScreenWidth - 30;
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(width * kscale);
}];
[self.closeButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(14 * kScreenScale);
}];
[self.sendView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView).offset(-30 * kScreenScale);
}];
nickColor = UIColorFromRGB(0x2F0060);
nickBackImageName = @"room_gift_broadcast_low_normal_nick_bg";
bgImageName = @"room_gift_broadcast_low_bg";
closeImageName = @"room_gift_broadcast_low_close";
boraderImageName = @"room_gift_broadcast_low_avatar_board";
self.roomIdBgView.hidden = YES;
lineColor = UIColorFromRGB(0x66B5FF);
bgBtnColor = UIColorFromRGB(0x283889);
bgImageName = @"pi_room_gift_broadcast_low_bg";
}
break;
case BroadCastLevel_Middle:
{
CGFloat kscale = (CGFloat)120/ (CGFloat)345;
CGFloat width = KScreenWidth - 30;
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(width * kscale);
}];;
[self.closeButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(11 * kScreenScale);
}];
[self.sendView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView).offset(-30 * kScreenScale);
}];
nickColor = [UIColor whiteColor];
nickBackImageName = @"room_gift_broadcast_middle_normal_nick_bg";
bgImageName = @"room_gift_broadcast_middle_bg";
closeImageName = @"room_gift_broadcast_middle_close";
boraderImageName = @"room_gift_broadcast_middle_avatar_board";
self.roomIdBgView.hidden = YES;
lineColor = UIColorFromRGB(0xFE9FFF);
bgBtnColor = UIColorFromRGB(0x49157D);
bgImageName = @"pi_room_gift_broadcast_middle_bg";
}
break;
case BroadCastLevel_High:
{
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(143 * kScreenScale);
}];
[self.closeButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(38 * kScreenScale);
}];
[self.sendView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView).offset(-26 * kScreenScale);
}];
nickColor = [UIColor whiteColor];
nickBackImageName = @"room_gift_broadcast_high_normal_nick_bg";
bgImageName = @"room_gift_broadcast_high_bg";
closeImageName = @"room_gift_broadcast_high_close";
boraderImageName = @"room_gift_broadcast_high_avatar_boardd";
self.roomIdBgView.hidden = NO;
lineColor = UIColorFromRGB(0xFFED77);
bgBtnColor = UIColorFromRGB(0x87152D);
bgImageName = @"pi_room_gift_broadcast_high_bg";
}
break;
default:
{
CGFloat kscale = (CGFloat)124/ (CGFloat)345;
CGFloat width = KScreenWidth - 30;
[self.backImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(width * kscale);
}];
[self.closeButton mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(14 * kScreenScale);
}];
[self.sendView mas_updateConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView).offset(-30 * kScreenScale);
}];
nickColor = UIColorFromRGB(0x2F0060);
nickBackImageName = @"room_gift_broadcast_low_normal_nick_bg";
bgImageName = @"room_gift_broadcast_low_bg";
closeImageName = @"room_gift_broadcast_low_close";
boraderImageName = @"room_gift_broadcast_low_avatar_board";
self.roomIdBgView.hidden = YES;
lineColor = UIColorFromRGB(0x66B5FF);
bgBtnColor = UIColorFromRGB(0x283889);
bgImageName = @"pi_room_gift_broadcast_low_bg";
}
break;
}
if (nickBackImageName.length > 0) {
[self.sendView.nickButton setBackgroundImage:[UIImage imageNamed:nickBackImageName] forState:UIControlStateNormal];
[self.receiveView.nickButton setBackgroundImage:[UIImage imageNamed:nickBackImageName] forState:UIControlStateNormal];
}
if(boraderImageName.length > 0){
self.sendView.boraderImageView.image = kImage(boraderImageName);
self.receiveView.boraderImageView.image = kImage(boraderImageName);
}
if (nickColor) {
[self.sendView.nickButton setTitleColor:nickColor forState:UIControlStateNormal];
[self.receiveView.nickButton setTitleColor:nickColor forState:UIControlStateNormal];
}
[self.closeButton setBackgroundImage:kImage(closeImageName) forState:UIControlStateNormal];
self.backImageView.image = [UIImage imageNamed:bgImageName];
self.circuseeBtn.layer.borderColor = lineColor.CGColor;
self.circuseeBtn.backgroundColor = bgBtnColor;
}
@@ -350,18 +213,14 @@
if (broadcastModel.sendUserNick.length > 6) {
broadcastModel.sendUserNick = [broadcastModel.sendUserNick substringToIndex:6];
}
self.sendView.avatarImageView.imageUrl = broadcastModel.sendUserAvatar;
[self.sendView.nickButton setTitle:broadcastModel.sendUserNick forState:UIControlStateNormal];
self.senderAvatarView.imageUrl = _broadcastModel.sendUserAvatar;
if (broadcastModel.recvUserNick.length > 6) {
broadcastModel.recvUserNick = [broadcastModel.recvUserNick substringToIndex:6];
}
self.receiveView.avatarImageView.imageUrl = broadcastModel.recvUserAvatar;
[self.receiveView.nickButton setTitle:broadcastModel.recvUserNick forState:UIControlStateNormal];
self.giftImageView.imageUrl = broadcastModel.giftUrl;
self.countLabel.text = [NSString stringWithFormat:@"x%ld", broadcastModel.giftNum];
self.roomIdLabel.text = [NSString stringWithFormat:@"ID:%@", broadcastModel.roomErbanNo];
[self updateSubviews:broadcastModel.levelNum];
}
}
@@ -374,29 +233,28 @@
}
return _backImageView;
}
- (XPRoomGiftUserView *)sendView {
if (!_sendView) {
_sendView = [[XPRoomGiftUserView alloc] init];
-(NetImageView *)senderAvatarView{
if(!_senderAvatarView){
NetImageConfig *config = [[NetImageConfig alloc]init];
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_senderAvatarView = [[NetImageView alloc]initWithConfig:config];
_senderAvatarView.layer.cornerRadius = kGetScaleWidth(44)/2;
_senderAvatarView.layer.masksToBounds = YES;
}
return _sendView;
return _senderAvatarView;
}
- (UIImageView *)sendImageView {
if (!_sendImageView) {
_sendImageView = [[UIImageView alloc] init];
_sendImageView.userInteractionEnabled = YES;
_sendImageView.image = [UIImage imageNamed:@"room_gift_broadcast_send"];
- (MarqueeLabel *)pi_contentView{
if(!_pi_contentView){
_pi_contentView = [[MarqueeLabel alloc] init];
_pi_contentView.scrollDuration = 6.0;
_pi_contentView.fadeLength = 8.0f;
_pi_contentView.textAlignment = NSTextAlignmentCenter;
}
return _sendImageView;
return _pi_contentView;
}
- (XPRoomGiftUserView *)receiveView {
if (!_receiveView) {
_receiveView = [[XPRoomGiftUserView alloc] init];
}
return _receiveView;
}
- (NetImageView *)giftImageView {
if (!_giftImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
@@ -409,36 +267,39 @@
- (UILabel *)countLabel {
if (!_countLabel) {
_countLabel = [[UILabel alloc] init];
_countLabel.font = [UIFont systemFontOfSize:11 weight:UIFontWeightBold];
UIImage *image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFDC6A),UIColorFromRGB(0xFFFFFF),UIColorFromRGB(0xFFFFFF)] gradientType:GradientTypeTopToBottom imgSize:CGSizeMake(10, 10)];
_countLabel.textColor = [UIColor colorWithPatternImage:image];
_countLabel.textColor = UIColorFromRGB(0xFFE468);
_countLabel.font = kFontHeavy(16);
}
return _countLabel;
}
- (UIButton *)closeButton {
if (!_closeButton) {
_closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_closeButton addTarget:self action:@selector(closeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _closeButton;
}
- (UILabel *)roomIdLabel {
if (!_roomIdLabel) {
_roomIdLabel = [[UILabel alloc] init];
_roomIdLabel.font = [UIFont systemFontOfSize:12];
_roomIdLabel.textColor = [UIColor whiteColor];
}
return _roomIdLabel;
}
-(UIImageView *)roomIdBgView{
if (!_roomIdBgView){
_roomIdBgView = [UIImageView new];
_roomIdBgView.image = kImage(@"room_gift_broadcast_high_normal_id_nick_bg");
}
return _roomIdBgView;
}
- (UILabel *)roomNameLabel {
if (!_roomNameLabel) {
_roomNameLabel = [[UILabel alloc] init];
_roomNameLabel.font = kFontRegular(12);
_roomNameLabel.textColor = [UIColor whiteColor];
}
return _roomNameLabel;
}
- (UIImageView *)pi_roomIconView{
if(!_pi_roomIconView){
_pi_roomIconView = [UIImageView new];
_pi_roomIconView.image = kImage(@"pi_room_gift_broadcast_room_icon");
}
return _pi_roomIconView;
}
- (UIButton *)circuseeBtn{
if(!_circuseeBtn){
_circuseeBtn = [UIButton new];
[_circuseeBtn setTitle:YMLocalizedString(@"XPAcrpssRoomPKPanelView3") forState:UIControlStateNormal];
_circuseeBtn.titleLabel.font = kFontRegular(10);
_circuseeBtn.layer.cornerRadius = kGetScaleWidth(20)/2;
_circuseeBtn.layer.masksToBounds = YES;
}
return _circuseeBtn;
}
@end