1076 lines
44 KiB
Objective-C
1076 lines
44 KiB
Objective-C
//
|
|
// QXRoomSeatBarView.m
|
|
// QXLive
|
|
//
|
|
// Created by 启星 on 2026/1/4.
|
|
//
|
|
|
|
#import "QXRoomSeatBarView.h"
|
|
#import "QXMineNetwork.h"
|
|
#import "QXRoomBarSetTimeView.h"
|
|
#import "QXRoomBarSetGiftView.h"
|
|
#import "QXBarAskAlertView.h"
|
|
#import "QXSeductionAlertView.h"
|
|
#import "QXRoomBarSendCustomGiftView.h"
|
|
#import "QXCustomAlertView.h"
|
|
#import "QXFileManager.h"
|
|
#import "QXRechargeViewcController.h"
|
|
|
|
@interface QXRoomSeatBarView()<QXRoomSeatBarViewDelagate,QXRoomBarSetGiftViewDelegate,QXBarAskAlertViewDelegate>
|
|
/// 主持
|
|
@property (nonatomic,strong)QXRoomSeatContentView *compereView;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatContentView *guestView;
|
|
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView1;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView2;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView3;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView4;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView5;
|
|
/// 嘉宾
|
|
@property (nonatomic,strong)QXRoomSeatBarSeatView *seatView6;
|
|
|
|
@property (nonatomic,strong)UIButton *ruleBtn;
|
|
@property (nonatomic,strong)UIView *leftSettingView;
|
|
@property (nonatomic,strong)UIButton *timeBtn;
|
|
@property (nonatomic,strong)UIView *rightSettingView;
|
|
@property (nonatomic,strong)UIButton *giftBtn;
|
|
|
|
/// seatArray
|
|
@property (nonatomic,strong)NSMutableArray *seatArray;
|
|
@property (nonatomic, strong) NSTimer *checkTimer;
|
|
|
|
@property (nonatomic, strong) UIButton *seaKingBtn;
|
|
@end
|
|
@implementation QXRoomSeatBarView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self initSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)initSubviews{
|
|
self.leftSettingView = [[UIView alloc] init];
|
|
self.leftSettingView.hidden = YES;
|
|
[self addSubview:self.leftSettingView];
|
|
|
|
self.rightSettingView = [[UIView alloc] init];
|
|
[self addSubview:self.rightSettingView];
|
|
|
|
self.timeBtn = [[UIButton alloc] init];
|
|
// [self.timeBtn setTitle:@"设置时长" forState:(UIControlStateNormal)];
|
|
// [self.timeBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
|
// self.timeBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
|
[self.timeBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_set_seat_time"] forState:(UIControlStateNormal)];
|
|
[self.timeBtn addTarget:self action:@selector(timeAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
// [self.timeBtn addRoundedCornersWithRadius:ScaleWidth(30)];
|
|
// self.timeBtn.backgroundColor = QXConfig.themeColor;
|
|
[self.leftSettingView addSubview:self.timeBtn];
|
|
|
|
self.ruleBtn = [[UIButton alloc] init];
|
|
[self.rightSettingView addSubview:self.ruleBtn];
|
|
[self.ruleBtn addTarget:self action:@selector(ruleAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self.ruleBtn setBackgroundImage:[UIImage imageNamed:@"nobility_help_icon"] forState:(UIControlStateNormal)];
|
|
|
|
self.giftBtn = [[UIButton alloc] init];
|
|
// [self.giftBtn setTitle:@"自定义礼物" forState:(UIControlStateNormal)];
|
|
// [self.giftBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
|
// self.giftBtn.titleLabel.font = [UIFont systemFontOfSize:14];
|
|
// [self.giftBtn addRoundedCornersWithRadius:ScaleWidth(30)];
|
|
// self.giftBtn.backgroundColor = QXConfig.themeColor;
|
|
[self.giftBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_set_custom_gift"] forState:(UIControlStateNormal)];
|
|
[self.giftBtn addTarget:self action:@selector(giftAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self.rightSettingView addSubview:self.giftBtn];
|
|
|
|
|
|
[self.leftSettingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self);
|
|
make.height.mas_equalTo(ScaleWidth(36));
|
|
make.width.mas_equalTo(ScaleWidth(53));
|
|
make.top.mas_equalTo(20);
|
|
}];
|
|
|
|
[self.rightSettingView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self);
|
|
make.height.mas_equalTo(ScaleWidth(57));
|
|
make.width.mas_equalTo(ScaleWidth(69));
|
|
make.top.equalTo(self);
|
|
}];
|
|
|
|
[self.ruleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.mas_equalTo(-5);
|
|
make.width.height.mas_equalTo(ScaleWidth(24));
|
|
make.top.equalTo(self.rightSettingView);
|
|
}];
|
|
|
|
[self.timeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.leftSettingView);
|
|
make.right.equalTo(self.leftSettingView);
|
|
make.top.equalTo(self.leftSettingView);
|
|
make.bottom.equalTo(self.leftSettingView);
|
|
}];
|
|
|
|
[self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.rightSettingView);
|
|
make.right.equalTo(self.rightSettingView);
|
|
make.bottom.equalTo(self.rightSettingView);
|
|
make.height.mas_equalTo(ScaleWidth(23));
|
|
}];
|
|
|
|
|
|
self.compereView = [[QXRoomSeatContentView alloc] init];
|
|
self.compereView.delegate = self;
|
|
self.compereView.tagString = QXText(@"主持");
|
|
self.compereView.number = 9;
|
|
[self addSubview:self.compereView];
|
|
CGFloat margin = (SCREEN_WIDTH/2-ScaleWidth(60))/2;
|
|
[self.compereView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self).offset(12);
|
|
make.width.mas_equalTo(ScaleWidth(65));
|
|
make.height.mas_equalTo(ScaleWidth(65-10)+51-ScaleWidth(15)-5);
|
|
make.centerX.equalTo(self).offset(ScaleWidth(-65));
|
|
}];
|
|
|
|
|
|
self.guestView = [[QXRoomSeatContentView alloc] init];
|
|
self.guestView.tagString = QXText(@"嘉宾");
|
|
self.guestView.number = 10;
|
|
// [self.guestView addTapBlock:^(id _Nonnull obj) {
|
|
// [weakSelf didClickSeatView:obj];
|
|
// }];
|
|
self.guestView.delegate = self;
|
|
[self addSubview:self.guestView];
|
|
[self.guestView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self).offset(12);
|
|
make.width.mas_equalTo(ScaleWidth(65));
|
|
make.height.mas_equalTo(ScaleWidth(65-10)+51-ScaleWidth(15)-5);
|
|
make.centerX.equalTo(self).offset(ScaleWidth(65));
|
|
}];
|
|
|
|
CGFloat seatHeight = ScaleWidth(60-10)+51-ScaleWidth(15)-5 + ScaleWidth(12+14)-5;
|
|
CGFloat seatSpace = (SCREEN_WIDTH - ScaleWidth(100)*3)/4;
|
|
|
|
self.seatView2 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView2.contentView.number = 2;
|
|
self.seatView2.delegate = self;
|
|
[self addSubview:self.seatView2];
|
|
[self.seatView2 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.mas_equalTo(ScaleWidth(100));
|
|
make.centerX.equalTo(self);
|
|
make.top.equalTo(self.compereView.mas_bottom);
|
|
make.height.mas_equalTo(seatHeight);
|
|
}];
|
|
|
|
|
|
self.seatView1 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView1.contentView.number = 1;
|
|
self.seatView1.delegate = self;
|
|
[self addSubview:self.seatView1];
|
|
[self.seatView1 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self.seatView2.mas_left).offset(-seatSpace);
|
|
make.top.width.height.equalTo(self.seatView2);
|
|
}];
|
|
|
|
self.seatView3 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView3.contentView.number = 3;
|
|
self.seatView3.delegate = self;
|
|
[self addSubview:self.seatView3];
|
|
|
|
[self.seatView3 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.seatView2.mas_right).offset(seatSpace);
|
|
make.top.width.height.equalTo(self.seatView2);
|
|
}];
|
|
|
|
self.seatView5 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView5.contentView.number = 5;
|
|
self.seatView5.delegate = self;
|
|
[self addSubview:self.seatView5];
|
|
[self.seatView5 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.seatView2.mas_bottom);
|
|
make.centerX.width.height.equalTo(self.seatView2);
|
|
}];
|
|
|
|
|
|
self.seatView4 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView4.contentView.number = 4;
|
|
self.seatView4.delegate = self;
|
|
[self addSubview:self.seatView4];
|
|
[self.seatView4 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.seatView5);
|
|
make.width.height.equalTo(self.seatView2);
|
|
make.centerX.equalTo(self.seatView1);
|
|
}];
|
|
|
|
self.seatView6 = [[QXRoomSeatBarSeatView alloc] init];
|
|
self.seatView6.contentView.number = 6;
|
|
self.seatView6.delegate = self;
|
|
[self addSubview:self.seatView6];
|
|
|
|
[self.seatView6 mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.seatView5);
|
|
make.width.height.equalTo(self.seatView2);
|
|
make.centerX.equalTo(self.seatView3);
|
|
}];
|
|
|
|
[self.seatArray addObject:self.seatView1];
|
|
[self.seatArray addObject:self.seatView2];
|
|
[self.seatArray addObject:self.seatView3];
|
|
[self.seatArray addObject:self.seatView4];
|
|
[self.seatArray addObject:self.seatView5];
|
|
[self.seatArray addObject:self.seatView6];
|
|
///7 号麦 (占位)
|
|
[self.seatArray addObject:[QXRoomSeatContentView new]];
|
|
///8 号麦 (占位)
|
|
[self.seatArray addObject:[QXRoomSeatContentView new]];
|
|
///9 号麦 (占位)
|
|
[self.seatArray addObject:self.compereView];
|
|
|
|
[self.seatArray addObject:self.guestView];
|
|
|
|
|
|
self.seaKingBtn = [[UIButton alloc] init];
|
|
[self.seaKingBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_sea_king"] forState:(UIControlStateNormal)];
|
|
[self.seaKingBtn addTarget:self action:@selector(everyOneFollowMe) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self addSubview:self.seaKingBtn];
|
|
[self.seaKingBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.seatView6.mas_bottom).offset(10);
|
|
make.centerX.equalTo(self);
|
|
make.width.mas_equalTo(ScaleWidth(128));
|
|
make.height.mas_equalTo(ScaleWidth(32));
|
|
}];
|
|
}
|
|
- (void)startCheckTimer {
|
|
self.checkTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
|
|
target:self
|
|
selector:@selector(checkAllSeatTime)
|
|
userInfo:nil
|
|
repeats:YES];
|
|
}
|
|
|
|
-(void)checkAllSeatTime{
|
|
for (int i = 0; i < 6;i++ ) {
|
|
QXRoomSeatBarSeatView *seatView = self.seatArray[i];
|
|
QXRoomPitModel *model = seatView.pitModel;
|
|
if (model.user_id.longLongValue > 0) {
|
|
NSTimeInterval timeInterval = [[NSDate date] timeIntervalSince1970];
|
|
// 将秒转换为毫秒
|
|
long long milliseconds = (long long)(timeInterval);
|
|
NSInteger timeDown = model.end_time.longLongValue - milliseconds;
|
|
if (timeDown <= 0) {
|
|
seatView.timeLabel.text = @"00:00";
|
|
}else{
|
|
seatView.timeLabel.text = [NSString stringWithFormat:@"%02ld:%02ld",timeDown/60,timeDown%60];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
-(void)timeAction{
|
|
QXRoomBarSetTimeView *setTimeView = [[QXRoomBarSetTimeView alloc] init];
|
|
setTimeView.roomId = self.roomModel.room_info.room_id;
|
|
[setTimeView showInView:self.viewController.view];
|
|
}
|
|
|
|
-(void)giftAction{
|
|
QXRoomBarSetGiftView *giftView = [[QXRoomBarSetGiftView alloc] init];
|
|
giftView.roomId = self.roomModel.room_info.room_id;
|
|
giftView.isLikeGift = NO;
|
|
[giftView showInView:self.viewController.view];
|
|
}
|
|
|
|
-(void)ruleAction{
|
|
NSString *server = QXGlobal.shareGlobal.currentServer;
|
|
NSString *urlString = [NSString stringWithFormat:@"%@api/Page/page_show?id=%@",server,@"36"];
|
|
QXBaseWebViewController *vc = [[QXBaseWebViewController alloc] init];
|
|
vc.urlStr = urlString;
|
|
[self.viewController.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
|
|
-(void)everyOneFollowMe{
|
|
NSInteger count = 0;
|
|
for (int i = 0 ; i < 6;i++) {
|
|
id object = self.seatArray[i];
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
// QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
// if (contentView.pitModel.user_id.longLongValue > 0 && ![contentView.pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
|
// }
|
|
continue;
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
if (contentView.contentView.pitModel.user_id.longLongValue > 0 && ![contentView.contentView.pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
|
count++;
|
|
}
|
|
continue;
|
|
}
|
|
}
|
|
if (count == 0) {
|
|
showToast(@"请等待用户上麦");
|
|
return;
|
|
}
|
|
|
|
QXCustomAlertView *alert = [[QXCustomAlertView alloc] init];
|
|
__weak typeof(self) weakSelf = self;
|
|
alert.commitBlock = ^{
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
if (!strongSelf) return;
|
|
[strongSelf everyOneComeOn];
|
|
};
|
|
[alert showInView:self.viewController.view title:@"温馨提示" message:[NSString stringWithFormat:@"确定要撩一撩台上全部嘉宾吗? 共计需要 %ld个 金币",self.roomModel.room_info.sexy_coin.integerValue*count] cancleTitle:@"取消" commitTitle:@"确定"];
|
|
}
|
|
|
|
-(void)everyOneComeOn{
|
|
[QXMineNetwork roomSeductionWithRoomId:self.roomModel.room_info.room_id to_user_id:@"" type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
|
|
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
}
|
|
|
|
-(void)setRoomModel:(QXRoomModel *)roomModel{
|
|
_roomModel = roomModel;
|
|
for (int i = 0 ; i < roomModel.room_info.pit_list.count;i++) {
|
|
QXRoomPitModel *pitModel = roomModel.room_info.pit_list[i];
|
|
id object = self.seatArray[i];
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
contentView.pitModel = pitModel;
|
|
[contentView hideCharm];
|
|
continue;
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
contentView.pitModel = pitModel;
|
|
[contentView.contentView hideCharm];
|
|
continue;
|
|
}
|
|
}
|
|
self.myPitNumber = roomModel.user_info.pit_number.integerValue;
|
|
[self startCheckTimer];
|
|
}
|
|
|
|
-(void)seductionUserWithPitModel:(QXRoomPitModel *)pitModel{
|
|
BOOL closeAlert = [[NSUserDefaults standardUserDefaults] boolForKey:kIsCloseSeductionAlert];
|
|
if (closeAlert) {
|
|
[QXMineNetwork roomSeductionWithRoomId:self.roomModel.room_info.room_id to_user_id:pitModel.user_id type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
|
|
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
}else{
|
|
QXSeductionAlertView *seductionView = [[QXSeductionAlertView alloc] init];
|
|
seductionView.alertType = QXSeductionAlertTypeSeduction;
|
|
seductionView.roomId = self.roomModel.room_info.room_id;
|
|
seductionView.sexy_coin = self.roomModel.room_info.sexy_coin;
|
|
seductionView.pitModel = pitModel;
|
|
[seductionView showInView:self.viewController.view];
|
|
}
|
|
|
|
}
|
|
|
|
-(void)askUserWithPitModel:(QXRoomPitModel *)pitModel{
|
|
QXBarAskAlertView *askView = [[QXBarAskAlertView alloc] init];
|
|
askView.roomId = self.roomModel.room_info.room_id;
|
|
askView.pitModel = pitModel;
|
|
askView.delegate = self;
|
|
[askView showInView:self.viewController.view];
|
|
}
|
|
|
|
-(void)sendGiftWithPitModel:(QXRoomPitModel *)pitModel{
|
|
QXRoomBarSendCustomGiftView *giftView = [[QXRoomBarSendCustomGiftView alloc] init];
|
|
giftView.roomId = self.roomModel.room_info.room_id;
|
|
giftView.pitModel = pitModel;
|
|
[giftView showInView:self.viewController.view];
|
|
}
|
|
#pragma mark - QXBarAskAlertViewDelegate
|
|
-(void)askViewDidRecharge:(QXBarAskAlertView *)alertView{
|
|
[alertView hide];
|
|
QXRechargeViewcController *vc = [[QXRechargeViewcController alloc] init];
|
|
[self.viewController.navigationController pushViewController:vc animated:YES];
|
|
}
|
|
|
|
-(void)askViewDidSend:(QXBarAskAlertView *)alertView pitModel:(nonnull QXRoomPitModel *)pitModel giftInfo:(nonnull QXGiftModel *)giftInfo{
|
|
[alertView hide];
|
|
[QXMineNetwork roomBarAskWithRoomId:self.roomModel.room_info.room_id user_id:pitModel.user_id gift_id:giftInfo.gift_id successBlock:^(NSDictionary * _Nonnull dict) {
|
|
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
}
|
|
#pragma mark - QXRoomBarSetGiftViewDelegate
|
|
-(void)setGiftModelIsLikeGift:(BOOL)isLikeGift giftModel:(QXGiftModel *)giftModel pitNumber:(nonnull NSString *)pitNumber setGiftView:(nonnull QXRoomBarSetGiftView *)setGiftView{
|
|
/// 自由麦请求
|
|
[setGiftView hide];
|
|
__weak typeof(self) weakSelf = self;
|
|
[QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pitNumber gift_id:giftModel.gift_id isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
|
|
__strong typeof(weakSelf) strongSelf = weakSelf;
|
|
if (!strongSelf) return;
|
|
if (strongSelf.delegate && [strongSelf.delegate respondsToSelector:@selector(upSeatFinish)]) {
|
|
[strongSelf.delegate upSeatFinish];
|
|
}
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
}
|
|
#pragma mark - QXRoomSeatBarViewDelagate
|
|
-(void)barRoomSeductionEffectWithModel:(QXRoomChatListModel *)model{
|
|
int count = 0;
|
|
for (int i = 0;i < 6 ; i++) {
|
|
QXRoomSeatBarSeatView *seatView = self.seatArray[i];
|
|
for (QXUserHomeModel*user in model.ToUserInfos) {
|
|
if ([user.user_id isEqualToString:seatView.pitModel.user_id]) {
|
|
count++;
|
|
if (count == 1) {
|
|
[seatView playSeductionEffectWithPlayImage:model.GiftInfo.play_image isMute:NO];
|
|
}else{
|
|
[seatView playSeductionEffectWithPlayImage:model.GiftInfo.play_image isMute:YES];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-(void)barRoomSetCustomGiftWithUserId:(NSString *)userId had_custom_gift:(BOOL)had_custom_gift{
|
|
for (int i = 0;i < 6 ; i++) {
|
|
QXRoomSeatBarSeatView *seatView = self.seatArray[i];
|
|
if ([seatView.pitModel.user_id isEqualToString:userId]) {
|
|
seatView.pitModel.had_custom_gift = had_custom_gift?1:0;
|
|
seatView.giftBtn.hidden = !had_custom_gift;
|
|
}
|
|
}
|
|
}
|
|
|
|
-(void)barRoomJoinCabinRoomWithRoomId:(NSString *)room_id user_id:(NSString *)user_id meet_user_id:(NSString *)meet_user_id{
|
|
if ([QXGlobal.shareGlobal.loginModel.user_id isEqualToString:user_id] || [QXGlobal.shareGlobal.loginModel.user_id isEqualToString:meet_user_id]) {
|
|
QXGlobal.shareGlobal.superRoomId = self.roomModel.room_info.room_id;
|
|
[[QXGlobal shareGlobal] joinRoomWithRoomId:room_id isRejoin:NO navagationController:self.viewController.navigationController];
|
|
}
|
|
}
|
|
|
|
-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number isPK:(BOOL)isPK end_time:(NSString *)end_time{
|
|
if (pit_number > 10) {
|
|
return;
|
|
}
|
|
UIView *objectV = self.seatArray[pit_number-1];
|
|
QXRoomPitModel *model;
|
|
if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV;
|
|
model = contentView.pitModel;
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV;
|
|
model = contentView.pitModel;
|
|
}
|
|
if (isUpSeat) {
|
|
model.user_id = user.user_id;
|
|
model.avatar = user.avatar;
|
|
model.dress = user.dress;
|
|
model.sex = user.sex;
|
|
model.nickname = user.nickname;
|
|
model.user_code = user.user_code;
|
|
model.charm = user.charm;
|
|
model.nobility_image = user.nobility_image;
|
|
model.nickname_color = user.nickname_color;
|
|
model.mic_cycle = user.mic_cycle;
|
|
model.had_custom_gift = user.had_custom_gift;
|
|
model.end_time = end_time;
|
|
}else{
|
|
model.user_id = @"0";
|
|
model.avatar = @"";
|
|
model.dress = @"";
|
|
model.sex = @"";
|
|
model.nickname = @"";
|
|
model.user_code = @"";
|
|
model.charm = @"";
|
|
model.nobility_image = @"";
|
|
model.nickname_color = @"";
|
|
model.mic_cycle = @"";
|
|
model.had_custom_gift = 0;
|
|
model.end_time = @"0";
|
|
if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV;
|
|
[contentView stopHWDMP4];
|
|
[contentView stopAudioAnimation];
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV;
|
|
[contentView stopHWDMP4];
|
|
[contentView.contentView stopAudioAnimation];
|
|
}
|
|
}
|
|
if ([user.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
|
|
if (isUpSeat) {
|
|
self.myPitNumber = pit_number;
|
|
}else{
|
|
self.myPitNumber = -1;
|
|
}
|
|
if (self.myPitNumber == 9) {
|
|
self.leftSettingView.hidden = NO;
|
|
}else{
|
|
self.leftSettingView.hidden = YES;
|
|
}
|
|
}
|
|
|
|
if ([objectV isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)objectV;
|
|
contentView.pitModel = model;
|
|
[contentView hideCharm];
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)objectV;
|
|
contentView.pitModel = model;
|
|
[contentView.contentView hideCharm];
|
|
}
|
|
}
|
|
-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{
|
|
NSString *pit_number = [NSString stringWithFormat:@"%ld",seatView.number] ;
|
|
QXLOG(@"点击了%ld麦位",seatView.number);
|
|
if (seatView.pitModel.user_id.longLongValue > 0) {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:userModel:isPkRoom:pkRoomId:isNoTakeOff:)]) {
|
|
[self.delegate didClickUserHeaderWithPitModel:seatView.pitModel userModel:nil isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO];
|
|
}
|
|
}else{
|
|
if (seatView.number == 9) {
|
|
/// 麦位没人时点9号麦直接请求上麦
|
|
[QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
|
|
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
return;
|
|
}else if (seatView.number == 10) {
|
|
if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1) {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) {
|
|
[self.delegate didHugSeatWithPitNumber:@"10"];
|
|
}
|
|
}else{
|
|
showToast(@"请等待主持抱麦");
|
|
}
|
|
return;
|
|
}else{
|
|
if (self.myPitNumber == 9) {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) {
|
|
[self.delegate didHugSeatWithPitNumber:pitModel.pit_number];
|
|
}
|
|
}else{
|
|
if (self.roomModel.room_info.room_up_pit_type.intValue == 2) {
|
|
if (self.myPitNumber > 0) {
|
|
if (self.myPitNumber == 10) {
|
|
// [self barRoomUpseatActionWithPitNumber:pit_number];
|
|
QXLOG(@"嘉宾不允许换麦");
|
|
}else{
|
|
id object = self.seatArray[seatView.number];
|
|
QXRoomPitModel *pitModel;
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
pitModel = contentView.pitModel;
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
pitModel = contentView.pitModel;
|
|
}
|
|
[QXMineNetwork roomUpSeatWithRoomId:self.roomModel.room_info.room_id pit_number:pit_number gift_id:@"" isUpSeat:YES successBlock:^(NSDictionary * _Nonnull dict) {
|
|
|
|
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
|
|
showToast(msg);
|
|
}];
|
|
}
|
|
}else{
|
|
[self barRoomUpseatActionWithPitNumber:pit_number];
|
|
}
|
|
}else{
|
|
// 排麦模式 弹出上麦
|
|
if (self.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1 || self.roomModel.user_info.is_management.intValue == 1 || self.roomModel.user_info.is_host.intValue == 1) {
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didHugSeatWithPitNumber:)]) {
|
|
[self.delegate didHugSeatWithPitNumber:pitModel.pit_number];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
-(void)barRoomUpseatActionWithPitNumber:(NSString*)pit_number{
|
|
QXRoomBarSetGiftView *giftView = [[QXRoomBarSetGiftView alloc] init];
|
|
giftView.roomId = self.roomModel.room_info.room_id;
|
|
giftView.pitNumber = pit_number;
|
|
giftView.isLikeGift = YES;
|
|
giftView.delegate = self;
|
|
[giftView showInView:self.viewController.view];
|
|
}
|
|
-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) {
|
|
[self.delegate previewRoomUserCharmListWithUserId:userId];
|
|
}
|
|
}
|
|
-(void)clearCharm{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *model = contentView.pitModel;
|
|
if (model) {
|
|
model.charm = @"0";
|
|
[contentView updateUserCharm:model.charm];
|
|
}
|
|
continue;
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
[contentView updateUserCharm:contentView.pitModel.charm];
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
-(void)roomClearUserCharmWithUserId:(NSString *)userId{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *model = contentView.pitModel;
|
|
if ([model.user_id isEqualToString:userId]) {
|
|
model.charm = @"0";
|
|
[contentView updateUserCharm:model.charm];
|
|
break;
|
|
}
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *model = contentView.pitModel;
|
|
if ([model.user_id isEqualToString:userId]) {
|
|
[contentView updateUserCharm:model.charm];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo isPK:(BOOL)isPK{
|
|
if (fromPitNumber == 0 || toPitNumber == 0) {
|
|
return;
|
|
}
|
|
if (toPitNumber > 10 || toPitNumber == 7 || toPitNumber == 8) {
|
|
return;
|
|
}
|
|
|
|
UIView *fromSeatView = self.seatArray[fromPitNumber-1];
|
|
UIView *toSeatView = self.seatArray[toPitNumber-1];
|
|
QXRoomPitModel *fromPitModel;
|
|
QXRoomPitModel *totModel;
|
|
if (fromPitNumber>6) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)fromSeatView;
|
|
fromPitModel = contentView.pitModel;
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)fromSeatView;
|
|
fromPitModel = contentView.pitModel;
|
|
}
|
|
if (toPitNumber>6) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)toSeatView;
|
|
totModel = contentView.pitModel;
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)toSeatView;
|
|
totModel = contentView.pitModel;
|
|
}
|
|
|
|
NSString* tmpPitNum = [NSString stringWithFormat:@"%@",fromPitModel.pit_number];
|
|
fromPitModel.pit_number = totModel.pit_number;
|
|
totModel.pit_number = tmpPitNum;
|
|
NSMutableArray*arr = [NSMutableArray arrayWithArray:self.roomModel.room_info.pit_list];
|
|
if (toPitNumber <= arr.count) {
|
|
[arr exchangeObjectAtIndex:fromPitNumber-1 withObjectAtIndex:toPitNumber-1];
|
|
}
|
|
self.roomModel.room_info.pit_list = arr;
|
|
if (fromPitNumber>6) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)fromSeatView;
|
|
contentView.pitModel = totModel;
|
|
[contentView hideCharm];
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)fromSeatView;
|
|
contentView.pitModel = totModel;
|
|
[contentView.contentView hideCharm];
|
|
}
|
|
if (toPitNumber>6) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)toSeatView;
|
|
contentView.pitModel = fromPitModel;
|
|
[contentView hideCharm];
|
|
}else{
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)toSeatView;
|
|
contentView.pitModel = fromPitModel;
|
|
[contentView.contentView hideCharm];
|
|
}
|
|
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
|
self.myPitNumber = toPitNumber;
|
|
if (self.myPitNumber == 9) {
|
|
self.leftSettingView.hidden = NO;
|
|
}else{
|
|
self.leftSettingView.hidden = YES;
|
|
}
|
|
}
|
|
}
|
|
|
|
-(void)setSeatCharmWithUser:(QXUserHomeModel *)model{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if ([model.user_id isEqualToString:md.user_id]) {
|
|
model.charm = @"0";
|
|
[contentView updateUserCharm:model.charm];
|
|
break;
|
|
}
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if ([model.user_id isEqualToString:md.user_id]) {
|
|
[contentView updateUserCharm:model.charm];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-(void)setSeatCharmWithUsers:(NSArray<QXUserHomeModel *> *)users{
|
|
for (QXUserHomeModel*model in users) {
|
|
[self setSeatCharmWithUser:model];
|
|
}
|
|
}
|
|
-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if ([user.user_id isEqualToString:md.user_id]) {
|
|
md.dress = user.dress;
|
|
md.nickname = user.nickname;
|
|
md.sex = user.sex;
|
|
md.avatar = user.avatar;
|
|
md.nobility_image = user.nobility_image;
|
|
md.nickname_color = user.nickname_color;
|
|
md.mic_cycle = user.mic_cycle;
|
|
contentView.pitModel = md;
|
|
[contentView hideCharm];
|
|
break;
|
|
}
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if ([user.user_id isEqualToString:md.user_id]) {
|
|
md.dress = user.dress;
|
|
md.nickname = user.nickname;
|
|
md.sex = user.sex;
|
|
md.avatar = user.avatar;
|
|
md.nobility_image = user.nobility_image;
|
|
md.nickname_color = user.nickname_color;
|
|
md.mic_cycle = user.mic_cycle;
|
|
contentView.pitModel = md;
|
|
[contentView.contentView hideCharm];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-(void)stopHWDMP4{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if (md) {
|
|
[contentView stopHWDMP4];
|
|
}
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if (md) {
|
|
[contentView.contentView stopHWDMP4];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-(void)playHWDMP4{
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if (md) {
|
|
[contentView playHWDMP4];
|
|
}
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if (md) {
|
|
[contentView.contentView playHWDMP4];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
-(void)destroyViews{
|
|
[self.compereView destroyViews];
|
|
[self.compereView destroyViews];
|
|
for (id object in self.seatArray) {
|
|
if ([object isKindOfClass:[QXRoomSeatContentView class] ]) {
|
|
QXRoomSeatContentView *contentView = (QXRoomSeatContentView*)object;
|
|
[contentView destroyViews];
|
|
}
|
|
if ([object isKindOfClass:[QXRoomSeatBarSeatView class] ]) {
|
|
QXRoomSeatBarSeatView *contentView = (QXRoomSeatBarSeatView*)object;
|
|
QXRoomPitModel *md = contentView.pitModel;
|
|
if (md) {
|
|
[contentView destroyViews];
|
|
}
|
|
}
|
|
}
|
|
[self.checkTimer invalidate];
|
|
self.checkTimer = nil;
|
|
}
|
|
-(NSMutableArray *)seatArray{
|
|
if (!_seatArray) {
|
|
_seatArray = [NSMutableArray array];
|
|
}
|
|
return _seatArray;
|
|
}
|
|
@end
|
|
|
|
|
|
@implementation QXRoomSeatBarSeatView
|
|
|
|
- (instancetype)init
|
|
{
|
|
self = [super init];
|
|
if (self) {
|
|
[self initSubviews];
|
|
}
|
|
return self;
|
|
}
|
|
-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel seatView:(QXRoomSeatContentView *)seatView{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(didClickUserHeaderWithPitModel:seatView:)]) {
|
|
[self.delegate didClickUserHeaderWithPitModel:pitModel seatView:seatView];
|
|
}
|
|
}
|
|
-(void)previewRoomUserCharmListWithUserId:(NSString *)userId{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(previewRoomUserCharmListWithUserId:)]) {
|
|
[self.delegate previewRoomUserCharmListWithUserId:userId];
|
|
}
|
|
}
|
|
-(void)setPitModel:(QXRoomPitModel *)pitModel{
|
|
_pitModel = pitModel;
|
|
|
|
if (pitModel.user_id.longLongValue>0) {
|
|
self.timeView.hidden = NO;
|
|
self.optionView.hidden = NO;
|
|
self.sexImageView.hidden = NO;
|
|
if (pitModel.had_custom_gift == 1) {
|
|
self.giftBtn.hidden = NO;
|
|
}else{
|
|
self.giftBtn.hidden = YES;
|
|
}
|
|
if ([pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
|
|
self.optionView.hidden = YES;
|
|
self.giftBtn.hidden = YES;
|
|
}
|
|
}else{
|
|
self.timeView.hidden = YES;
|
|
self.optionView.hidden = YES;
|
|
self.sexImageView.hidden = YES;
|
|
self.giftBtn.hidden = YES;
|
|
}
|
|
|
|
self.sexImageView.image = [UIImage imageNamed:pitModel.sex.intValue == 1?@"user_sex_boy":@"user_sex_girl"];
|
|
self.contentView.pitModel = pitModel;
|
|
}
|
|
-(void)updateUserCharm:(NSString *)charm{
|
|
[self.contentView updateUserCharm:charm];
|
|
}
|
|
-(void)giftAction{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(sendGiftWithPitModel:)]) {
|
|
[self.delegate sendGiftWithPitModel:self.pitModel];
|
|
}
|
|
}
|
|
-(void)seductionAction{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(seductionUserWithPitModel:)]) {
|
|
[self.delegate seductionUserWithPitModel:self.pitModel];
|
|
}
|
|
}
|
|
|
|
|
|
-(void)askAction{
|
|
if (self.delegate && [self.delegate respondsToSelector:@selector(askUserWithPitModel:)]) {
|
|
[self.delegate askUserWithPitModel:self.pitModel];
|
|
}
|
|
}
|
|
-(void)initSubviews{
|
|
self.timeView = [[UIView alloc] init];
|
|
[self addSubview:self.timeView];
|
|
[self.timeView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self);
|
|
make.width.mas_equalTo(ScaleWidth(55));
|
|
make.centerX.equalTo(self);
|
|
make.height.mas_equalTo(ScaleWidth(16));
|
|
}];
|
|
|
|
self.timeBgImageView = [[UIImageView alloc] init];
|
|
self.timeBgImageView.backgroundColor = RGB16(0x000000);
|
|
[self.timeBgImageView addRoundedCornersWithRadius:ScaleWidth(8)];
|
|
self.timeBgImageView.layer.borderWidth = 1;
|
|
self.timeBgImageView.layer.borderColor = RGB16A(0xffffff, 0.2).CGColor;
|
|
self.timeBgImageView.contentMode = UIViewContentModeScaleToFill;
|
|
[self.timeView addSubview:self.timeBgImageView];
|
|
[self.timeBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.edges.equalTo(self.timeView);
|
|
}];
|
|
|
|
self.timeLabel = [[UILabel alloc] init];
|
|
self.timeLabel.font = [UIFont systemFontOfSize:10];
|
|
self.timeLabel.textColor = RGB16(0xffffff);
|
|
self.timeLabel.text = @"00:00";
|
|
[self.timeView addSubview:self.timeLabel];
|
|
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.equalTo(self).offset(ScaleWidth(8));
|
|
make.top.bottom.equalTo(self.timeView);
|
|
}];
|
|
|
|
self.timeImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bar_room_time_icon"]];
|
|
[self.timeView addSubview:self.timeImageView];
|
|
[self.timeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self.timeLabel.mas_left).offset(-3);
|
|
make.height.width.mas_equalTo(12);
|
|
make.centerY.equalTo(self.timeView);
|
|
}];
|
|
|
|
|
|
|
|
|
|
self.contentView = [[QXRoomSeatContentView alloc] init];
|
|
self.contentView.delegate = self;
|
|
[self addSubview:self.contentView];
|
|
|
|
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.top.equalTo(self.timeView.mas_bottom).offset(-10);
|
|
make.width.mas_equalTo(ScaleWidth(60));
|
|
make.height.mas_equalTo(ScaleWidth(60-10)+51-ScaleWidth(15)-5);
|
|
make.centerX.mas_equalTo(self);
|
|
}];
|
|
|
|
self.optionView = [[UIView alloc] init];
|
|
[self addSubview:self.optionView];
|
|
|
|
[self.optionView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.bottom.equalTo(self);
|
|
make.centerX.equalTo(self);
|
|
make.height.mas_equalTo(ScaleWidth(14));
|
|
make.width.mas_equalTo(100);
|
|
}];
|
|
|
|
self.askBtn = [[UIButton alloc] init];
|
|
// self.askBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
|
// [self.askBtn setTitle:@"约TA" forState:(UIControlStateNormal)];
|
|
// [self.askBtn addRoundedCornersWithRadius:12.5];
|
|
// [self.askBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
|
// self.askBtn.backgroundColor = QXConfig.themeColor;
|
|
[self.askBtn addTarget:self action:@selector(askAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self.askBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_ask_ta"] forState:(UIControlStateNormal)];
|
|
[self.optionView addSubview:self.askBtn];
|
|
[self.askBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.centerX.equalTo(self.optionView).offset(ScaleWidth(-21.5));
|
|
make.width.mas_equalTo(ScaleWidth(38));
|
|
make.top.bottom.equalTo(self.optionView);
|
|
}];
|
|
|
|
self.seductionBtn = [[UIButton alloc] init];
|
|
// [self.seductionBtn setTitle:@"撩TA" forState:(UIControlStateNormal)];
|
|
// self.seductionBtn.titleLabel.font = [UIFont systemFontOfSize:12];
|
|
// [self.seductionBtn addRoundedCornersWithRadius:12.5];
|
|
// [self.seductionBtn setTitleColor:RGB16(0xffffff) forState:(UIControlStateNormal)];
|
|
// self.seductionBtn.backgroundColor = QXConfig.themeColor;
|
|
[self.seductionBtn setBackgroundImage:[UIImage imageNamed:@"bar_room_seduction_ta"] forState:(UIControlStateNormal)];
|
|
[self.seductionBtn addTarget:self action:@selector(seductionAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self.optionView addSubview:self.seductionBtn];
|
|
[self.seductionBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self.askBtn.mas_right).offset(5);
|
|
make.width.mas_equalTo(ScaleWidth(38));
|
|
make.top.bottom.equalTo(self.optionView);
|
|
|
|
}];
|
|
[self bringSubviewToFront:self.timeView];
|
|
|
|
self.sexImageView = [[UIImageView alloc] init];
|
|
[self addSubview:self.sexImageView];
|
|
[self.sexImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.width.height.mas_equalTo(15);
|
|
make.right.equalTo(self.contentView).offset(-5);
|
|
make.top.equalTo(self.contentView).offset(ScaleWidth(40));
|
|
}];
|
|
|
|
self.giftBtn = [[UIButton alloc] init];
|
|
[self.giftBtn setImage:[UIImage imageNamed:@"bar_room_custom_gift"] forState:(UIControlStateNormal)];
|
|
[self.giftBtn addTarget:self action:@selector(giftAction) forControlEvents:(UIControlEventTouchUpInside)];
|
|
[self addSubview:self.giftBtn];
|
|
[self.giftBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.equalTo(self);
|
|
make.right.equalTo(self.contentView.mas_left);
|
|
make.height.mas_equalTo(30);
|
|
make.top.equalTo(self.contentView).offset(12);
|
|
}];
|
|
|
|
[self addSubview:self.mp4View];
|
|
[self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.right.equalTo(self).offset(ScaleWidth(30));
|
|
make.width.mas_equalTo(ScaleWidth(100));
|
|
make.height.mas_equalTo(ScaleWidth(100/9*16));
|
|
make.top.equalTo(self.contentView).offset(-ScaleWidth((100/9*16)/2)+ScaleWidth(40));
|
|
}];
|
|
}
|
|
-(void)viewDidFinishPlayMP4:(NSInteger)totalFrameCount view:(VAPView *)container{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
self->_mp4View.hidden = YES;
|
|
[self->_mp4View stopHWDMP4];
|
|
});
|
|
}
|
|
|
|
-(void)viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container{
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
self->_mp4View.hidden = YES;
|
|
});
|
|
}
|
|
|
|
-(void)playSeductionEffectWithPlayImage:(NSString *)playImage isMute:(BOOL)isMute{
|
|
MJWeakSelf
|
|
if ([playImage hasPrefix:@"http"] || [playImage hasPrefix:@"https"]) {
|
|
[weakSelf.mp4View stopHWDMP4];
|
|
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:playImage completion:^(BOOL result, NSString * _Nonnull fileName) {
|
|
NSString *videoPath = [QXFileManager getGiftVideoPath:playImage.lastPathComponent];
|
|
weakSelf.mp4View.hidden = NO;
|
|
[weakSelf.mp4View setMute:isMute];
|
|
[weakSelf.mp4View playHWDMP4:videoPath repeatCount:1 delegate:self];
|
|
}];
|
|
// self.mp4View.hidden = NO;
|
|
// NSString *videoPath = [[NSBundle mainBundle] pathForResource:@"zizi" ofType:@"mp4"];
|
|
// [self.mp4View playHWDMP4:videoPath repeatCount:1 delegate:self];
|
|
|
|
}
|
|
}
|
|
|
|
- (VAPView *)mp4View {
|
|
if (!_mp4View) {
|
|
_mp4View = [[VAPView alloc] initWithFrame:CGRectZero];
|
|
_mp4View.hwd_enterBackgroundOP = HWDMP4EBOperationTypePauseAndResume;
|
|
_mp4View.contentMode = UIViewContentModeScaleAspectFit;
|
|
_mp4View.userInteractionEnabled = NO;
|
|
_mp4View.backgroundColor = [UIColor clearColor];
|
|
_mp4View.hidden = YES;
|
|
_mp4View.hwd_Delegate = self;
|
|
}
|
|
return _mp4View;
|
|
}
|
|
-(void)destroyViews{
|
|
[self.mp4View stopHWDMP4];
|
|
[self.contentView destroyViews];
|
|
}
|
|
@end
|