Files
featherVoice/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m
2025-08-14 09:40:25 +08:00

1733 lines
72 KiB
Objective-C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// QXRoomViewController.m
// QXLive
//
// Created by 启星 on 2025/6/7.
//
#import "QXRoomViewController.h"
#import "QXRoomTitleView.h"
#import "QXRoomSeatView.h"
#import "QXRoomBottomView.h"
#import "QXRoomChatListView.h"
#import "QXRoomSongListView.h"
#import "QXSendGiftView.h"
#import "QXSoundListView.h"
#import "QXUpSeatView.h"
#import "QXMineNetwork.h"
#import "QXRoomMessageManager.h"
#import "QXGiftPlayerManager.h"
#import "QXAgoraEngine.h"
#import "QXRoomSettingView.h"
#import "QXRoomSeatContentView.h"
#import "QXSongListModel.h"
#import "QXAlertView.h"
#import "QXCreateRoomViewController.h"
#import "QXRoomBgSettingView.h"
#import "QXRoomBgMusicView.h"
#import "QXRoomUserInfoView.h"
#import "QXHeadlineView.h"
#import "QXDirectSetScaleView.h"
#import "QXRoomPKSearchView.h"
#import "QXAgoraEngineEx.h"
#import "QXCabinMovieView.h"
#import "QXReportViewController.h"
#import "QXMessageViewController.h"
#import "QXRoomSubsidyViewController.h"
@interface QXRoomViewController ()<
QXRoomBottomViewDelegate,
QXRoomMessageManagerDelegate,
QXRoomSettingViewDelegate,
QXAgoraEngineMediaPlayerDelegate,
QXRoomSeatDelegate,
QXRoomUserInfoViewDelegate
>
@property (nonatomic,strong)UIImageView *roomBgImageView;
@property (nonatomic,strong)UIView *roomBgCoverView;
/// 顶部房间信息
@property (nonatomic,strong)QXRoomTitleView *titleView;
/// 麦位视图
@property (nonatomic,strong)QXRoomSeatView *seatContentView;
/// 底部工具栏
@property (nonatomic,strong)QXRoomBottomView *bottomView;
/// 聊天列表
@property (nonatomic,strong)QXRoomChatListView *chatListView;
/// 点唱view
@property (nonatomic,strong)QXRoomSongListView *songListView;
/// 发送礼物
@property (nonatomic,strong)QXSendGiftView *sendGiftView;
/// 声音特效
@property (nonatomic,strong)QXSoundListView *soundListView;
/// 申请上麦
@property (nonatomic,strong)QXUpSeatView *upSeatView;
@property (nonatomic,strong)UIButton *soundBtn;
@property (nonatomic,strong)UIButton *upSeatBtn;
/// 排麦按钮
@property (nonatomic,strong)QXUpSeatCountView *micTeamView;
@property (nonatomic,strong)QXRoomModel* roomModel;
/// 礼物特效
@property (nonatomic,strong)UIView *bgEffectView;
/// 设置
@property (nonatomic,strong)QXRoomSettingView *settingView;
/// 房间背景
@property (nonatomic,strong)QXRoomBgSettingView *roomBgSetView;
/// 背景音乐
@property (nonatomic,strong)QXRoomBgMusicView *musicView;
// 查看用户信息
@property (nonatomic,strong)QXRoomUserInfoView *userInfoView;
///头条
@property (nonatomic,strong)QXHeadlineView *headlineView;
/// 发布头条
@property (nonatomic,strong)QXDirectSetScaleView *sendHeadLineView;
/// pk search
@property (nonatomic,strong)QXRoomPKSearchView *pkSearchView;
/// 电影房
@property (nonatomic,strong)QXCabinMovieView *movieView;
/// 连送按钮
@property (nonatomic,strong)QXContinuousGiftView *continuousView;
@end
@implementation QXRoomViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
[self.navigationController setNavigationBarHidden:YES animated:YES];
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
-(void)viewDidAppear:(BOOL)animated{
[super viewDidAppear:animated];
NSMutableArray *marr = [[NSMutableArray alloc]initWithArray:self.navigationController.viewControllers];
// for (UIViewController *vc in marr) {
// if ([vc isKindOfClass:[QXRoomViewController class]]) {
// [marr removeObject:vc];
// break;
// }
// }
for (int i = 0; i < marr.count; i++) {
UIViewController *vc = marr[i];
if ([vc isKindOfClass:[QXRoomViewController class]] && (i == marr.count-2)) {
[marr removeObject:vc];
break;
}
}
self.navigationController.viewControllers = marr;
// self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
[UIApplication sharedApplication].idleTimerDisabled = NO;
[[QXGiftPlayerManager shareManager] stopPlay];
self.continuousView.hidden = YES;
}
-(void)initSubViews{
// [self updateBgImage:@"room_background"];
self.bgImageHidden = YES;
self.roomBgImageView = [[UIImageView alloc] initWithFrame:self.view.bounds];
// self.roomBgImageView.image = [UIImage imageNamed:@"room_background"];
self.roomBgImageView.contentMode = UIViewContentModeScaleAspectFill;
self.roomBgImageView.clipsToBounds = YES;
[self.view addSubview:self.roomBgImageView];
self.roomBgCoverView = [[UIView alloc] initWithFrame:self.view.bounds];
self.roomBgCoverView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.2];
[self.view addSubview:self.roomBgCoverView];
self.view.backgroundColor = RGB16(0x333333);
self.titleView = [[QXRoomTitleView alloc] initWithFrame:CGRectMake(0, kSafeAreaTop, SCREEN_WIDTH, ScaleWidth(74))];
self.titleView.roomId = self.roomId;
self.titleView.delegate = self;
[self.view addSubview:self.titleView];
[self.view insertSubview:self.seatContentView belowSubview:self.titleView];
[self.seatContentView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.titleView.bottom+20);
make.height.mas_equalTo(ScaleWidth(60+50*2)+51*3+1+0);
}];
[self.view addSubview:self.bottomView];
[self.bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.view);
make.height.mas_equalTo(36+kSafeAreaBottom);
make.left.right.equalTo(self.view);
}];
[self.view addSubview:self.upSeatBtn];
[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);
}];
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.bottom.equalTo(self.upSeatBtn.mas_top).offset(-12);
}];
self.micTeamView.hidden = YES;
[self.view addSubview:self.micTeamView];
[self.micTeamView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(self.view);
make.size.mas_equalTo(CGSizeMake(ScaleWidth(98), ScaleWidth(43)));
make.bottom.equalTo(self.soundBtn.mas_top).offset(-12);
}];
[self.view addSubview:self.chatListView];
[self.chatListView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
make.right.equalTo(self.soundBtn.mas_left).offset(-16);
}];
[self.sendGiftView reloadData];
if (self.isReJoin) {
[self.chatListView insertNoitce];
[self getRoomInfo];
}else{
[self joinRoom];
}
[self setupEffectView];
// [self.view addSubview:self.headlineView];
}
#pragma mark - 特效
- (void)setupEffectView {
if (!_bgEffectView) {
[self.view insertSubview:self.bgEffectView aboveSubview:self.seatContentView];
CGFloat padding = ScaleWidth(20);
[self.bgEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.bottom.left.right.equalTo(self.view);
}];
QXEffectContentView *fullEffectView = [[QXGiftPlayerManager shareManager] defaultFullEffectView];
[fullEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.centerY.equalTo(self.bgEffectView);
make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT));
}];
QXEffectContentView *chatEffectView = [[QXGiftPlayerManager shareManager] defaultChatEffectView];
[chatEffectView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(self.seatContentView.mas_bottom).offset(padding);
// make.left.right.equalTo(self.bgEffectView);
make.bottom.mas_equalTo(-padding);
make.centerX.equalTo(self.bgEffectView);
make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT));
}];
}
BOOL isClose = [[NSUserDefaults standardUserDefaults] boolForKey:kEffectsCLose];
[[QXGiftPlayerManager shareManager] openOrCloseEffectViewWith:!isClose];
}
#pragma mark - 获取房间信息
-(void)joinRoom{
[self.chatListView insertNoitce];
[[QXRoomMessageManager shared] joinGroupWithRoomId:self.roomId];
MJWeakSelf
[QXMineNetwork joinRoomWithRoomId:self.roomId successBlock:^(QXRoomModel * _Nonnull roomModel) {
// roomModel.room_info.pk_room_id = @"33";
weakSelf.roomModel = roomModel;
[weakSelf resetSubviews];
[weakSelf configRoomDataIsJoin:YES];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomId];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[weakSelf.navigationController popViewControllerAnimated:YES];
});
}];
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
NSMutableArray *arr = [NSMutableArray arrayWithArray:onPitList];
[arr addObjectsFromArray:offPitList];
weakSelf.titleView.onlineUsers = arr;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)getUserOnlineStatusWithUserIds:(NSString*)userIds{
[QXMineNetwork roomUserOnlineStatusWithUserIds:userIds roomId:self.roomId successBlock:^(NSArray<QXUserModel *> * _Nonnull list) {
for (QXUserModel *md in list) {
if (md.user_id.longLongValue > 0) {
[[NSNotificationCenter defaultCenter] postNotificationName:noticeRoomUserOnlineStatusDidChanged object:@{@"user_id":md.user_id,@"is_online":[NSNumber numberWithBool:md.is_online]}];
}
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)getRoomInfo{
MJWeakSelf
[QXMineNetwork getRoomInfoWithRoomId:self.roomId successBlock:^(QXRoomModel * _Nonnull roomModel) {
weakSelf.roomModel = roomModel;
[weakSelf resetSubviews];
[weakSelf configRoomDataIsJoin:NO];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
[QXMineNetwork roomOnlineListWithRoomId:self.roomId page:1 successBlock:^(NSArray<QXRoomUserInfoModel *> * _Nonnull onPitList, NSArray<QXRoomUserInfoModel *> * _Nonnull offPitList) {
NSMutableArray *arr = [NSMutableArray arrayWithArray:onPitList];
[arr addObjectsFromArray:offPitList];
weakSelf.titleView.onlineUsers = arr;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
-(void)resetSubviews{
if (self.roomModel.room_info.type_id.intValue != 6) {
[self.roomBgImageView sd_setImageWithURL:[NSURL URLWithString:self.roomModel.room_info.room_background]];
}else{
self.roomBgImageView.image = [UIImage imageNamed:@"cp_room_bg"];
}
if (self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) {
// 点唱房
if (self.roomModel.room_info.label_id.intValue == 1) {
if (self.roomModel.pk_info.pk_room_id.intValue>0) {
/// 在pk状态
[self.seatContentView setType:(QXRoomSeatViewTypePK)];
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.titleView.bottom+12);
make.height.mas_equalTo(ScaleWidth(330));
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
// make.right.equalTo(self.soundBtn.mas_left).offset(-16);
make.width.mas_equalTo(ScaleWidth(280));
}];
}else{
// 聊天
[self.seatContentView setType:(QXRoomSeatViewTypeNormal)];
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(self.titleView.bottom+20);
make.height.mas_equalTo(ScaleWidth(60+50*2)+51*3+1+0);
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
// make.right.equalTo(self.soundBtn.mas_left).offset(-16);
make.width.mas_equalTo(ScaleWidth(280));
}];
}
}else{
if (_musicView) {
[[QXAgoraEngine sharedEngine] ktv_EndSing];
[_musicView removeFromSuperview];
_musicView = nil;
}
[self.seatContentView setType:(QXRoomSeatViewTypeSing)];
// k歌
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(kSafeAreaTop+44);
make.height.mas_equalTo(ScaleWidth(277)+44+ScaleWidth(50-10)+51);
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom).offset(-(ScaleWidth(50-10)+51));
// make.right.equalTo(self.soundBtn.mas_left).offset(-16);
make.width.mas_equalTo(ScaleWidth(280));
}];
}
}else if (self.roomModel.room_info.type_id.intValue == 2) {
[self.seatContentView setType:(QXRoomSeatViewTypeAuction)];
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(kSafeAreaTop+ScaleWidth(40)+12);
make.height.mas_equalTo(ScaleWidth(328));
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
// make.right.equalTo(self.soundBtn.mas_left).offset(-16);
make.width.mas_equalTo(ScaleWidth(280));
}];
}else if (self.roomModel.room_info.type_id.intValue == 6) {
//小黑屋
[self.seatContentView setType:(QXRoomSeatViewTypeCabin)];
self.titleView.hidden = YES;
self.upSeatBtn.hidden = YES;
self.bottomView.isCabinRoom = YES;
[self.seatContentView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.left.right.equalTo(self.view);
make.top.mas_equalTo(kSafeAreaTop);
make.height.mas_equalTo(ScaleWidth(380));
}];
[self.chatListView mas_remakeConstraints:^(MASConstraintMaker *make) {
make.bottom.equalTo(self.bottomView.mas_top);
make.left.equalTo(self.view);
make.top.equalTo(self.seatContentView.mas_bottom);
make.width.mas_equalTo(ScaleWidth(280));
}];
[self.view insertSubview:self.movieView atIndex:0];
}
if (self.roomModel.room_info.last_pk_room_id.isExist) {
if (![self.roomModel.room_info.last_pk_room_id isEqualToString:self.roomModel.pk_info.pk_room_id]) {
[[QXAgoraEngineEx sharedEngine] quitEXChannelWithLastPkRoomId:self.roomModel.room_info.last_pk_room_id];
}
}
}
-(void)configRoomDataIsJoin:(BOOL)isJoin{
self.seatContentView.hidden = NO;
self.bottomView.hidden = NO;
NSMutableArray *userIds = [NSMutableArray array];
for (QXRoomPitModel *md in self.roomModel.room_info.pit_list) {
if (md.user_id.longLongValue > 0) {
[userIds addObject:md.user_id];
}
}
[self getUserOnlineStatusWithUserIds:[userIds componentsJoinedByString:@","]];
self.micTeamView.countLabel.text = self.roomModel.room_info.queue_number;
self.titleView.roomModel = self.roomModel;
if (self.roomModel.user_info.pit_number.intValue > 0) {
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES];
[[QXAgoraEngine sharedEngine] enableAudio:NO];
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:NO];
self.seatContentView.myPitNumber = self.roomModel.user_info.pit_number.intValue;
}else{
self.seatContentView.myPitNumber = -1;
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:NO];
[[QXAgoraEngine sharedEngine] enableAudio:NO];
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:YES];
}
self.seatContentView.roomModel = self.roomModel;
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 2){
/// k歌房没有背景音乐
[QXAgoraEngine sharedEngine].isPlayBgMusic = NO;
}else{
[QXAgoraEngine sharedEngine].isPlayBgMusic = YES;
}
//音效按钮
if (self.seatContentView.myPitNumber == 9) {
self.soundBtn.hidden = NO;
self.titleView.isCompere = YES;
}else{
self.soundBtn.hidden = YES;
self.titleView.isCompere = NO;
}
if (self.roomModel.room_info.head_line != nil) {
if (_headlineView == nil) {
self.headlineView.model = self.roomModel.room_info.head_line;
[self.view addSubview:self.headlineView];
}
}
[self configBottomTools];
if (isJoin) {
MJWeakSelf
[[QXAgoraEngine sharedEngine] joinChannel:self.roomId withRoom:self agora_token:self.roomModel.user_info.agora_token agora_rtm_token:self.roomModel.user_info.agora_rtm_token isUpSeat:self.seatContentView.myPitNumber>0 successBock:^{
if (weakSelf.roomModel.song_user_info && (weakSelf.roomModel.room_info.type_id.intValue == 1 || weakSelf.roomModel.room_info.type_id.intValue == 3 || weakSelf.roomModel.room_info.type_id.intValue == 4) && weakSelf.roomModel.room_info.label_id.intValue == 2) {
if ([weakSelf.roomModel.song_user_info.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
// [[QXAgoraEngine sharedEngine] ktv_EndSing];
// [[QXAgoraEngine sharedEngine] ktv_StartSing:YES withSong:weakSelf.roomModel.song_user_info];
weakSelf.seatContentView.songInfo = weakSelf.roomModel.song_user_info;
weakSelf.seatContentView.nextInfo = weakSelf.roomModel.nextInfo;
/// 临时上麦
if (weakSelf.seatContentView.myPitNumber <= 0) {
/// 我不在麦上 临时拉起权限
weakSelf.bottomView.status = 2;
[weakSelf.bottomView setMuteAudioStatus:1];
}
}else{
weakSelf.seatContentView.songInfo = weakSelf.roomModel.song_user_info;
weakSelf.seatContentView.nextInfo = weakSelf.roomModel.nextInfo;
}
}
if (self.roomModel.room_info.type_id.intValue == 6) {
NSInteger uid = 0;
if (![weakSelf.roomModel.cp_user.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
uid = weakSelf.roomModel.cp_user.user_id.longLongValue;
}else{
uid = weakSelf.roomModel.cp_user.user_id1.longLongValue;
}
//// if (_movieView) {
//// [_movieView removeFromSuperview];
//// _movieView = nil;
//// }
[[QXAgoraEngine sharedEngine] startPreViewWithUid:uid view:self.movieView.videoView];
}
}];
}else{
if (self.roomModel.song_user_info && (self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 2) {
if ([self.roomModel.song_user_info.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
self.seatContentView.songInfo = self.roomModel.song_user_info;
self.seatContentView.nextInfo = self.roomModel.nextInfo;
}else{
self.seatContentView.songInfo = self.roomModel.song_user_info;
self.seatContentView.nextInfo = self.roomModel.nextInfo;
}
}
}
[QXRoomMessageManager shared].delegate = self;
[QXAgoraEngine sharedEngine].delegate = self;
if (self.roomModel.room_info.type_id.intValue == 6) {
self.bottomView.isCabinRoom = YES;
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES];
}
if (self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) {
// 点唱房
if (self.roomModel.room_info.label_id.intValue == 1) {
if (self.roomModel.pk_info.pk_id.intValue>0) {
MJWeakSelf
[QXMineNetwork getRoomInfoWithRoomId:self.roomModel.pk_info.pk_room_id successBlock:^(QXRoomModel * _Nonnull roomModel) {
weakSelf.seatContentView.pkRoomModel = roomModel;
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
if (self.seatContentView.myPitNumber == 9) {
[QXMineNetwork updateShengWangTokenWithRoomId:weakSelf.roomModel.pk_info.pk_room_id successBlock:^(NSString * _Nonnull token) {
[[QXAgoraEngineEx sharedEngine] joinExWithAgora_token:token channel:weakSelf.roomModel.pk_info.pk_room_id];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
}
}
}
if (self.roomModel.room_info.type_id.intValue == 2) {
[self auctionListDidChanged:self.roomModel.room_auction.auction_list];
}
}
-(void)configMicType:(BOOL)isOnSeat{
if (self.roomModel.room_info.room_up_pit_type.intValue == 1 && self.roomModel.room_info.type_id.intValue != 6) {
self.micTeamView.hidden = NO;
}else{
self.micTeamView.hidden = YES;
}
self.upSeatBtn.selected = isOnSeat;
}
-(void)configBottomTools{
self.bottomView.roomModel = self.roomModel;
BOOL hasPK = NO;
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 1) {
hasPK = YES;
}
BOOL hasSong = YES;
if (self.roomModel.room_info.type_id.intValue == 2){
hasSong = NO;
}
/// 普通麦位
if (self.seatContentView.myPitNumber <= 0) {
self.bottomView.status = 1;
[self configMicType:NO];
[self.bottomView setRoleType:(QXRoomRoleTypeAudience) hasPK:hasPK hasSong:hasSong];
}else{
if (self.seatContentView.myPitNumber == 9) {
[self.bottomView setRoleType:(QXRoomRoleTypeCompere) hasPK:hasPK hasSong:hasSong];
}else{
[self.bottomView setRoleType:(QXRoomRoleTypeAudience) hasPK:hasPK hasSong:hasSong];
}
self.bottomView.status = 2;
[self configMicType:YES];
}
}
/// 声浪回调
-(void)onRTCEngineRoomPublishSoundLevelUpdate:(NSDictionary<NSString *,NSNumber *> *)soundLevels{
// if (self.roomModel.room_info.type_id.intValue == 1 && self.roomModel.room_info.label_id.intValue == 1) {
// for (NSString *userId in soundLevels.allKeys) {
// for (QXRoomSeatContentView *seatContentView in self.seatContentView.normalSeatView.seatArray) {
// if ([seatContentView.pitModel.user_id isEqualToString:userId]) {
// if ([soundLevels[userId] integerValue] > 0) {
// [seatContentView startAudioAnimation];
// }else {
// [seatContentView stopAudioAnimation];
// }
// break;
// }
// }
// }
// }
// for (AgoraRtcAudioVolumeInfo *info in soundLevels) {
// if (info.uid == 0) {
// if (info.volume > 0) {
// [seatView startAudioAnimation];
// }else {
// [seatView stopAudioAnimation];
// }
// break;
// }else{
// if (info.volume > 0) {
// [seatView startAudioAnimation];
// }else {
// [seatView stopAudioAnimation];
// }
// break;
// }
// }
// for (NSString *userId in soundLevels.allKeys) {
// QXRoomSeatContentView *seatView = self.seatContentView.seatDict[userId];
// if ([soundLevels[userId] integerValue] > 0) {
// [seatView startAudioAnimation];
// }else {
// [seatView stopAudioAnimation];
// }
// }
}
-(void)rtcEngineLocalAudioMixingDidFinish{
}
-(void)rtcEngineVideoFirstLoadWithUid:(NSInteger)uid size:(CGSize)size{
self.movieView.hidden = NO;
[self.view bringSubviewToFront:self.movieView];
}
-(void)rtcEngineVideoDidStart:(NSInteger)uid{
self.movieView.hidden = NO;
[self.view bringSubviewToFront:self.movieView];
}
-(void)rtcEngineVideoDidStop:(NSInteger)uid{
if (self.movieView.isFullScreen) {
[self.movieView resetView];
}
self.movieView.hidden = YES;
}
#pragma mark - 推送通知
-(void)roomOnlineNumberDidChangedOnlineNumber:(NSString *)onlineNumber{
[self.titleView setOnlineNumber:onlineNumber];
}
/// 下一首歌状态发生变化
-(void)nextSongDidChangedWithNextSong:(QXSongListModel *)nextInfo{
self.seatContentView.nextInfo = nextInfo;
}
/// 演唱者歌词回调
-(void)rtcEngineSongLrc:(NSString *)lrcUrl{
self.seatContentView.lrcUrl = lrcUrl;
}
// 演唱者歌曲播放回调
-(void)rtcEngineSongProgress:(NSUInteger)progress{
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 2) {
self.seatContentView.progress = progress;
}else{
self.musicView.progress = progress;
}
}
/// 观众同步歌词
-(void)roomSongLrcProgress:(NSUInteger)progress{
self.seatContentView.progress = progress;
}
// 有人发起点歌申请
-(void)applySongWaitAgreeWithUserNickname:(NSString *)nickname{
if (self.seatContentView.myPitNumber == 9) {
// 弹出是否同意
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeAgreeSong;
al.message = [NSString stringWithFormat:@"%@ 正在发起点歌",nickname];
al.commitBlock = ^{
[QXMineNetwork agreeApplySongWithRoomId:weakSelf.roomId type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
};
al.cancelBlock = ^{
[QXMineNetwork agreeApplySongWithRoomId:weakSelf.roomId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}
}
// 主播拒绝了点歌申请
-(void)applySongNoAgreeWithUserId:(NSString *)userId{
if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
showToast(@"主持拒绝了您的点歌申请");
}
}
/// 切歌后回调
-(void)nextSongDidStartWithSongInfo:(QXSongListModel *)songInfo nextInfo:(QXSongListModel *)nextInfo{
self.seatContentView.songInfo = songInfo;
self.seatContentView.nextInfo = nextInfo;
if ([songInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
// [[QXAgoraEngine sharedEngine] ktv_EndSing];
// [[QXAgoraEngine sharedEngine] ktv_StartSing:YES withSong:songInfo];
if (self.seatContentView.myPitNumber <= 0) {
/// 我不在麦上 临时拉起权限
self.bottomView.status = 2;
[self.bottomView setMuteAudioStatus:1];
}
}else{
// [[QXAgoraEngine sharedEngine] ktv_EndSing];
// [[QXAgoraEngine sharedEngine] ktv_LoadLrcWithSong:songInfo];
if (self.seatContentView.myPitNumber <= 0) {
self.bottomView.status = 1;
}
}
}
/// 插入消息
-(void)didInsertMessge:(QXRoomChatListModel *)message{
[self.chatListView insertMessage:message];
}
-(void)didInsertMessge:(QXRoomChatListModel *)message userId:(NSString *)userId{
if ([userId isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[self.chatListView insertMessage:message];
}
}
/// 上下麦发生变化
-(void)didUpDownSeatWithUser:(QXUserHomeModel *)user isUpSeat:(BOOL)isUpSeat pit_number:(NSInteger)pit_number{
[self.seatContentView didUpDownSeatWithUser:user isUpSeat:isUpSeat pit_number:pit_number];
if ([user.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:isUpSeat];
self.bottomView.status = isUpSeat?2:1;
if (!isUpSeat) {
/// 下麦 停止音频模块
[[QXAgoraEngine sharedEngine] enableAudio:NO];
self.seatContentView.myPitNumber = -1;
if (_musicView) {
[[QXAgoraEngine sharedEngine] ktv_EndSing];
[_musicView removeFromSuperview];
_musicView = nil;
}
}else{
/// 上麦 停止音频模块 (因首次上麦 未打开麦克风 所以此处需要停止音频模块)
[[QXAgoraEngine sharedEngine] enableAudio:NO];
/// 开启本地推流 虽音频模块未打开,但本地音乐及音效需要进行推流
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:NO];
self.seatContentView.myPitNumber = pit_number;
}
if (self.seatContentView.myPitNumber == 9) {
self.soundBtn.hidden = NO;
self.titleView.isCompere = YES;
}else{
self.soundBtn.hidden = YES;
self.titleView.isCompere = NO;
}
[self configBottomTools];
}
}
// 踢出房间
-(void)userDidTakeOffWithUserInfo:(QXUserHomeModel *)userInfo{
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
[[QXGlobal shareGlobal] quitRoomWithRoomId:self.roomId];
// self.navigationController.interactivePopGestureRecognizer.enabled = YES;
[self.navigationController popViewControllerAnimated:YES];
}
}
// 设置管理员 | 主持
-(void)roomSetManagerOrCompere:(QXUserHomeModel *)userInfo isManager:(BOOL)isManager isAdd:(BOOL)isAdd{
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
if (isManager) {
if (isAdd) {
self.roomModel.user_info.is_management = @"1";
}else{
self.roomModel.user_info.is_management = @"0";
}
}else{
if (isAdd) {
self.roomModel.user_info.is_host = @"1";
}else{
self.roomModel.user_info.is_host = @"0";
}
}
}
}
/// 清除魅力
-(void)roomClearCharm{
[self.seatContentView clearCharm];
}
/// 收到礼物设置魅力
-(void)didRecieveGiftWithWithUserInfo:(QXUserHomeModel *)userInfo{
[self.seatContentView setSeatCharmWithUser:userInfo];
}
/// 拍卖者上麦
-(void)auctionUpSeatWithUserInfo:(QXUserHomeModel *)userInfo isUpSeat:(BOOL)isUpSeat{
[self.seatContentView didAuctiontUpDownSeatWithUser:userInfo isUpSeat:isUpSeat];
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:isUpSeat];
self.bottomView.status = isUpSeat?2:1;
if (!isUpSeat) {
/// 下麦 停止音频模块
[[QXAgoraEngine sharedEngine] enableAudio:NO];
self.seatContentView.myPitNumber = -1;
if (_musicView) {
[[QXAgoraEngine sharedEngine] ktv_EndSing];
[_musicView removeFromSuperview];
_musicView = nil;
}
}else{
/// 上麦 停止音频模块 (因首次上麦 未打开麦克风 所以此处需要停止音频模块)
[[QXAgoraEngine sharedEngine] enableAudio:NO];
/// 开启本地推流 虽音频模块未打开,但本地音乐及音效需要进行推流
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:NO];
self.seatContentView.myPitNumber = 888;
}
if (self.seatContentView.myPitNumber == 9) {
self.soundBtn.hidden = NO;
self.titleView.isCompere = YES;
}else{
self.soundBtn.hidden = YES;
self.titleView.isCompere = NO;
}
[self configBottomTools];
}
}
/// 用户 禁言|禁麦 状态 发生变化
-(void)userMuteStatusDidChanged:(QXUserHomeModel *)userInfo isMute:(NSString *)isMute isMutePit:(NSString *)isMutePit{
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
self.roomModel.user_info.is_mute = isMute;
self.roomModel.user_info.is_mute_pit = isMutePit;
if (isMutePit.intValue == 1) {
[self.bottomView setMuteAudioStatus:0];
[[QXAgoraEngine sharedEngine] enableAudio:NO];
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:YES];
}
}
}
/// 二卡八麦位状态变化
-(void)roomSeatStatusDidChangedIsLock:(NSString *)is_lock pit_number:(NSString *)pit_number{
[self.seatContentView setSeatIsLock:is_lock pitNumber:pit_number];
}
-(void)aplayMicInLineNumberDidChanged:(NSString *)number{
self.micTeamView.countLabel.text = number;
}
-(void)cabinRoomValueDidChanged:(NSString *)hotValue{
[self.seatContentView cabinRoomHotValueDidChanged:hotValue];
}
-(void)roomOnlineNumberDidChangedIsAdd:(BOOL)isAdd{
[self.titleView onlineNumberIsAdd:isAdd];
}
-(void)roomUserInfoDidChanged:(QXUserHomeModel *)user{
[self.seatContentView roomUserInfoDidChanged:user];
}
-(void)previewUserInfoWithUserId:(NSString *)userId{
QXRoomOwnerModel *md = [QXRoomOwnerModel new];
md.user_id = userId;
[self didClickUserHeaderWithPitModel:nil userModel:md isPkRoom:NO pkRoomId:@"" isNoTakeOff:NO];
}
-(void)auctionGiftAction:(QXRoomPitModel *)user auctionId:(NSString *)auctionId{
self.sendGiftView.type = QXSendGiftViewTypeAuction;
QXRoomPitModel *model = [[QXRoomPitModel alloc] init];
model.pit_number = @"-1";
model.user_id = user.user_id;
model.nickname = user.nickname;
model.avatar = user.avatar;
self.sendGiftView.userModel = model;
self.sendGiftView.auctionId = auctionId;
self.sendGiftView.roomId = self.roomId;
[self.sendGiftView showInView:self.view];
// [[QXGlobal shareGlobal] showView:self.sendGiftView controller:self popType:(PopViewTypeBottomToUpActionSheet) tapDismiss:YES finishBlock:^{
//
// }];
}
///修改房间类型
-(void)auctionTypeDidChanged:(NSString *)type{
[self.seatContentView auctionTypeDidChanged:type];
}
/// 开始拍卖
-(void)auctionStartOrEndIsStart:(BOOL)isStart user:(QXRoomAuctionUser *)user getUser:(QXRoomAuctionUser *)getUser{
[self.seatContentView auctionStartOrEndIsStart:isStart user:user getUser:getUser];
if (!isStart) {
[self auctionListDidChanged:@[]];
}
}
/// 拍卖列表发生变化
-(void)auctionListDidChanged:(NSArray<QXRoomPitModel *> *)auctionList{
BOOL haveMe = NO;
// for (QXRoomPitModel*pitModel in auctionList) {
// if ([pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
// haveMe = YES;
// break;
// }
// }
for (int i = 0; i < auctionList.count; i++) {
if (i < 3) {
QXRoomPitModel*pitModel = auctionList[i];
if ([pitModel.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
haveMe = YES;
break;
}
}
}
if ([self.roomModel.room_auction.auction_user.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
haveMe = YES;
}
if (self.seatContentView.myPitNumber>=0) {
haveMe = YES;
}
if (haveMe == NO) {
self.bottomView.status = 1;
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:NO];
}else{
self.bottomView.status = 2;
if ([QXAgoraEngine sharedEngine].isOpenMic) {
[self.bottomView setMuteAudioStatus:1];
}else{
[self.bottomView setMuteAudioStatus:0];
}
}
[self.seatContentView auctionListDidChanged:auctionList];
}
/// 拍卖被延时
-(void)auctionTimeDelayWithEndTime:(NSString *)endTime{
[self.seatContentView auctionDelayTimeWithEndTime:endTime];
}
/// 清空消息
-(void)didClearAllMessage{
[self.chatListView clearMessage];
}
// 麦序模式发生变化
-(void)aplayPitModeDidChanged:(NSString *)upMicType{
self.roomModel.room_info.room_up_pit_type = upMicType;
if (upMicType.intValue == 1) {
self.micTeamView.hidden = NO;
}else{
// if (self.seatContentView.myPitNumber > 0) {
// self.upSeatBtn.selected = YES;
// }else{
// self.upSeatBtn.selected = NO;
// }
self.micTeamView.hidden = YES;
}
self.settingView.roomModel = self.roomModel;
}
/// 房间类型发生变化
-(void)roomTypeDidChanged{
[self getRoomInfo];
}
/// 房间信息发生变化
-(void)roomInfoDidChanged:(QXRoomInfoModel *)roomInfo{
self.roomModel.room_info.room_name = roomInfo.room_name;
self.roomModel.room_info.room_cover = roomInfo.room_cover;
self.roomModel.room_info.room_number = roomInfo.room_number;
self.roomModel.room_info.room_background = roomInfo.room_background;
self.titleView.roomModel = self.roomModel;
[self.roomBgImageView sd_setImageWithURL:[NSURL URLWithString:roomInfo.room_background]];
}
// 下一首歌
-(void)rtcEngineBackgroundMusicNextSong:(QXSongListModel *)songModel{
self.musicView.songModel = songModel;
}
-(void)songRoomCharmRankListDidChanged:(NSArray<QXRoomPitModel *> *)list{
[self.seatContentView songRoomCharmRankListDidChanged:list];
}
#pragma mark - pk 相关
-(void)recievePKInviteWithSendRoomId:(NSString *)SendRoomId AcceptRoomId:(NSString *)AcceptRoomId PkId:(NSString *)PkId message:(nonnull NSString *)message{
if (self.seatContentView.myPitNumber == 9) {
/// 找主持 主持弹窗 发起者不会收到
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeAgreeSong;
al.message = message;
al.commitBlock = ^{
[QXMineNetwork roomPkAgreeWithPk_id:PkId type:@"1" successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
};
al.cancelBlock = ^{
// [QXMineNetwork roomPkAgreeWithPk_id:PkId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
//
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
// showToast(msg);
// }];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}
}
/// 败方想跑路
-(void)roomPKRecieveLoserWantToRunRoadWithUserInfo:(QXUserHomeModel *)fromUserInfo{
if (self.seatContentView.myPitNumber == 9) {
/// 找主持 主持弹窗 发起者不会收到
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeAgreeSong;
al.message = [NSString stringWithFormat:@"%@想结束本厂PK您确定结束吗",fromUserInfo.nickname];
al.commitBlock = ^{
[QXMineNetwork roomPkEndWithPk_id:weakSelf.roomModel.pk_info.pk_id type:@"3" user_id:[QXGlobal shareGlobal].loginModel.user_id successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
};
al.cancelBlock = ^{
// [QXMineNetwork roomPkAgreeWithPk_id:PkId type:@"2" successBlock:^(NSDictionary * _Nonnull dict) {
//
// } failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
// showToast(msg);
// }];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}
}
-(void)agreeOrRefusePKIsAgree:(BOOL)isAgree user_id:(nonnull NSString *)user_id room_id:(nonnull NSString *)room_id pk_id:(NSString*)pk_id{
if (isAgree) {
/// 更新自己房间信息 更换界面
// [self getRoomInfo];
MJWeakSelf
[QXMineNetwork getRoomInfoWithRoomId:self.roomId successBlock:^(QXRoomModel * _Nonnull roomModel) {
weakSelf.roomModel = roomModel;
[weakSelf resetSubviews];
weakSelf.seatContentView.roomModel = roomModel;
/// 这里的roomId 是对方的roomid 获取对方房间信息 赋值给右侧视图 pk分为左右两侧 左侧为自己 右侧是对方
[QXMineNetwork getRoomInfoWithRoomId:room_id successBlock:^(QXRoomModel * _Nonnull roomModel) {
weakSelf.seatContentView.pkRoomModel = roomModel;
if (self.seatContentView.myPitNumber == 9) {
// 如果自己当前在9号麦 加入对方房间
[[QXAgoraEngineEx sharedEngine] joinExWithAgora_token:roomModel.user_info.agora_token channel:room_id];
}
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
}];
}
}
-(void)pkStartWithPkEndTimes:(NSString *)pk_end_times pk_id:(NSString*)pk_id{
[self.seatContentView pkStartWithPkEndTimes:pk_end_times pk_id:pk_id];
}
-(void)roomPKValueDidChangedWithRoomIdA:(NSString *)room_id_a create_value_a:(NSString *)create_value_a room_id_b:(NSString *)room_id_b receive_value_b:(NSString *)receive_value_b{
[self.seatContentView roomPKValueDidChangedWithRoomIdA:room_id_a create_value_a:create_value_a room_id_b:room_id_b receive_value_b:receive_value_b];
}
-(void)pkResultWithIsVictory:(NSInteger)isVictory end_time:(nonnull NSString *)end_time victory_name:(nonnull NSString *)victory_name victory_cover:(nonnull NSString *)victory_cover defeated_name:(nonnull NSString *)defeated_name defeated_cover:(nonnull NSString *)defeated_cover{
[self.seatContentView pkResultWithIsVictory:isVictory end_time:end_time victory_name:victory_name victory_cover:victory_cover defeated_name:defeated_name defeated_cover:defeated_cover];
}
-(void)pkDisConnect{
[[QXAgoraEngineEx sharedEngine] quitEXChannelWithLastPkRoomId:@""];
[self getRoomInfo];
}
-(void)pkMuteRemoteAudio:(BOOL)isMute fromUserInfo:(nonnull QXUserHomeModel *)fromUserInfo{
[[QXAgoraEngineEx sharedEngine] muteLocalEXAudioStream:isMute fromUserInfo:fromUserInfo];
}
-(void)recieveHeadline:(QXHeadLineModel *)headline{
if (_headlineView) {
self.headlineView.model = headline;
}else{
self.headlineView.model = headline;
[self.view addSubview:self.headlineView];
}
}
#pragma mark - QXRoomBottomViewDelegate
-(void)didClickEventType:(QXRoomBottomViewEventType)type isSelected:(BOOL)isSelected{
switch (type) {
case QXRoomBottomViewEventTypePlayAudio:{
[[QXAgoraEngine sharedEngine] muteAllRemoteAudioStreams:isSelected];
[[QXAgoraEngineEx sharedEngine] muteRemoteEXAudioStream:isSelected];
}
break;
case QXRoomBottomViewEventTypeMuteAudio:{
if (!isSelected) {
/// 静音时麦圈停止
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 1) {
// QXRoomSeatContentView *seatContentView = self.seatContentView.normalSeatView.mySeatView;
// if (seatContentView.isSeatSpeaking) {
// [seatContentView stopAudioAnimation];
// }
}
}
QXLOG(isSelected?@"开麦":@"闭麦");
[[QXAgoraEngine sharedEngine] enableAudio:isSelected];
if (isSelected) {
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES];
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:NO];
}else{
AgoraRtcAudioVolumeInfo *info = [[AgoraRtcAudioVolumeInfo alloc] init];
info.uid = [QXGlobal shareGlobal].loginModel.user_id.longLongValue;
info.volume = 0;
[[NSNotificationCenter defaultCenter] postNotificationName:noticeUserSpeak object:info];
NSDictionary *dict = @{
@"is_mute":[NSNumber numberWithInteger:0],
};
NSString *jsonStr = [dict jsonStringEncoded];
[[QXRoomMessageManager shared] sendChatMessage:jsonStr messageType:(QXRoomMessageTypeMuteLocalAudio) needInsertMessage:NO];
}
// [[QXAgoraEngine sharedEngine] muteLocalAudioStream:!isSelected];
}
break;
case QXRoomBottomViewEventTypeMessage:{
QXMessageViewController *vc = [[QXMessageViewController alloc] initWithIsFromRoom:YES];
QXBaseNavigationController *na = [[QXBaseNavigationController alloc] initWithRootViewController:vc];
na.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:na animated:YES completion:nil];
// vc.isFromRoom = YES;
// // 设置初始 frame (在屏幕下方)
// CGRect finalFrame = CGRectMake(0, SCREEN_HEIGHT- ScaleWidth(429),
// self.view.bounds.size.width,
// ScaleWidth(429));
// CGRect initialFrame = CGRectOffset(finalFrame, 0, finalFrame.size.height);
// vc.view.frame = initialFrame;
//
// // 添加圆角
// vc.view.layer.cornerRadius = 10;
// vc.view.layer.maskedCorners = kCALayerMinXMinYCorner | kCALayerMaxXMinYCorner;
// vc.view.clipsToBounds = YES;
//
// // 添加阴影
// vc.view.layer.shadowColor = [UIColor blackColor].CGColor;
// vc.view.layer.shadowOffset = CGSizeMake(0, -5);
// vc.view.layer.shadowOpacity = 0.3;
// vc.view.layer.shadowRadius = 10;
//
// // 添加为子视图控制器
// [self addChildViewController:vc];
// [self.view addSubview:vc.view];
// [vc didMoveToParentViewController:self];
//
// // 创建半透明背景
// UIView *dimmingView = [[UIView alloc] initWithFrame:self.view.bounds];
// dimmingView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];
// dimmingView.alpha = 0;
// dimmingView.tag = 212;
// [self.view insertSubview:dimmingView belowSubview:vc.view];
//
// // 添加点击手势
// UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(dismissHalfScreenView)];
// [dimmingView addGestureRecognizer:tap];
//
// // 执行动画
// [UIView animateWithDuration:0.3 animations:^{
// vc.view.frame = finalFrame;
// dimmingView.alpha = 1;
// }];
}
break;
case QXRoomBottomViewEventTypePK:{
self.pkSearchView.roomId = self.roomModel.room_info.room_id;
[self.pkSearchView showInView:self.view];
}
break;
case QXRoomBottomViewEventTypeMusic:{
if ((self.roomModel.room_info.type_id.intValue == 1 || self.roomModel.room_info.type_id.intValue == 3 || self.roomModel.room_info.type_id.intValue == 4) && self.roomModel.room_info.label_id.intValue == 1){
MJWeakSelf
QXAlertView *al = [[QXAlertView alloc] initWithFrame:CGRectMake(0, 0, ScaleWidth(300), ScaleWidth(175))];
al.type = QXAlertViewTypeApplySong;
al.commitBlock = ^{
[QXMineNetwork applySongWithRoomId:weakSelf.roomId successBlock:^(NSDictionary * _Nonnull dict) {
showToast(@"已发起点歌,请等待主持同意");
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
};
[[QXGlobal shareGlobal] showView:al popType:(PopViewTypeTopToCenter) tapDismiss:NO finishBlock:^{
}];
}else{
self.songListView.isCompere = self.seatContentView.myPitNumber==9;
self.songListView.isBgMusic = [QXAgoraEngine sharedEngine].isPlayBgMusic;
[self.songListView showInView:self.view];
}
}
break;
case QXRoomBottomViewEventTypeGift:{
self.sendGiftView.type = QXSendGiftViewTypeRoom;
if (self.sendGiftView.titles.count == 0) {
[self.sendGiftView reloadData];
}
QXRoomPitModel *compereModel = nil;
QXRoomPitModel *guestModel = nil;
NSMutableArray *pitArr = [NSMutableArray array];
if (self.roomModel.room_info.pit_list.count == 10) {
QXRoomPitModel *md = self.roomModel.room_info.pit_list[8];
if (md.user_id.longValue > 0 && ![QXGlobal.shareGlobal.loginModel.user_id isEqualToString:md.user_id]) {
[pitArr addObject:md];
QXRoomPitModel *lastMd = self.roomModel.room_info.pit_list[9];
if (lastMd.user_id.longValue > 0) {
[pitArr addObject:lastMd];
}
}else{
QXRoomPitModel *lastMd = self.roomModel.room_info.pit_list[9];
if (lastMd.user_id.longValue > 0) {
[pitArr addObject:lastMd];
}
}
for (int i = 0; i < self.roomModel.room_info.pit_list.count;i++) {
QXRoomPitModel *md = self.roomModel.room_info.pit_list[i];
md.isSelected = NO;
if (md.pit_number.intValue == 9) {
compereModel = md;
continue;
}else if (md.pit_number.intValue == 10) {
guestModel = md;
continue;
}else{
if (md.user_id.longValue > 0 && ![md.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[pitArr addObject:md];
}
}
}
}else{
for (int i = 0; i < self.roomModel.room_info.pit_list.count;i++) {
QXRoomPitModel *md = self.roomModel.room_info.pit_list[i];
md.isSelected = NO;
if (md.user_id.longValue > 0 && ![md.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[pitArr addObject:md];
}
if (md.pit_number.intValue == 9) {
compereModel = md;
continue;
}else if (md.pit_number.intValue == 10) {
guestModel = md;
continue;
}
}
}
// k歌麦位
if (self.roomModel.song_user_info) {
if ([self.roomModel.song_user_info.user_id isEqualToString:compereModel.user_id] || [self.roomModel.song_user_info.user_id isEqualToString:guestModel.user_id]) {
}else{
QXRoomPitModel*md = [[QXRoomPitModel alloc] init];
md.nickname = self.roomModel.song_user_info.nickname;
md.user_id = self.roomModel.song_user_info.user_id;
md.avatar = self.roomModel.song_user_info.avatar;
md.pit_number = @"9999";
[pitArr addObject:md];
}
}
if (self.roomModel.song_pit_list.count > 0) {
for (QXRoomPitModel*md in self.roomModel.song_pit_list) {
if ([md.user_id isEqualToString:self.roomModel.song_user_info.user_id]) {
continue;
}
if (md.user_id.longValue > 0 && ![QXGlobal.shareGlobal.loginModel.user_id isEqualToString:md.user_id]) {
[pitArr addObject:md];
}
}
}
// 拍卖
if (self.roomModel.room_auction.auction_user) {
QXRoomPitModel*md = [[QXRoomPitModel alloc] init];
md.nickname = self.roomModel.room_auction.auction_user.nickname;
md.user_id = self.roomModel.room_auction.auction_user.user_id;
md.avatar = self.roomModel.room_auction.auction_user.avatar;
md.pit_number = @"9999";
[pitArr addObject:md];
}
if (self.roomModel.room_auction.auction_list.count > 0) {
for (QXRoomPitModel*md in self.roomModel.room_auction.auction_list) {
if ([md.user_id isEqualToString:compereModel.user_id]) {
continue;
}
if (md.user_id.longValue > 0 && ![QXGlobal.shareGlobal.loginModel.user_id isEqualToString:md.user_id]) {
[pitArr addObject:md];
}
}
}
self.sendGiftView.pitUsers = pitArr;
self.sendGiftView.roomId = self.roomId;
[self.sendGiftView showInView:self.view];
// [[QXGlobal shareGlobal] showView:self.sendGiftView controller:self popType:(PopViewTypeBottomToUpActionSheet) tapDismiss:YES finishBlock:^{
//
// }];
}
break;
case QXRoomBottomViewEventTypeSetting:{
if (self.roomModel.user_info.is_room_owner.intValue == 1) {
BOOL isUpSeat = self.seatContentView.myPitNumber>0;
self.settingView.roomModel = self.roomModel;
[self.settingView updateRole:(QXRoomRoleTypeOwner) isUpSeat:isUpSeat];
[self.settingView showInView:self.view];
return;
}else if (self.roomModel.user_info.is_management.intValue == 1) {
BOOL isUpSeat = self.seatContentView.myPitNumber>0;
self.settingView.roomModel = self.roomModel;
[self.settingView updateRole:(QXRoomRoleTypeManager) isUpSeat:isUpSeat];
[self.settingView showInView:self.view];
return;
}else if (self.roomModel.user_info.is_host.intValue == 1) {
self.settingView.roomModel = self.roomModel;
BOOL isUpSeat = self.seatContentView.myPitNumber==9;
[self.settingView updateRole:(QXRoomRoleTypeCompere) isUpSeat:isUpSeat];
[self.settingView showInView:self.view];
return;
}else{
self.settingView.roomModel = self.roomModel;
BOOL isUpSeat = self.seatContentView.myPitNumber>0;
[self.settingView updateRole:(QXRoomRoleTypeAudience) isUpSeat:isUpSeat];
[self.settingView showInView:self.view];
}
}
break;
default:
break;
}
}
- (void)dismissHalfScreenView {
UIViewController *halfScreenVC = self.childViewControllers.lastObject;
UIView *dimmingView = [self.view viewWithTag:212];
[UIView animateWithDuration:0.3 animations:^{
halfScreenVC.view.frame = CGRectOffset(halfScreenVC.view.frame, 0, halfScreenVC.view.frame.size.height);
dimmingView.alpha = 0;
} completion:^(BOOL finished) {
[halfScreenVC willMoveToParentViewController:nil];
[halfScreenVC.view removeFromSuperview];
[halfScreenVC removeFromParentViewController];
[dimmingView removeFromSuperview];
}];
}
#pragma mark - 麦位点击用户信息
-(void)didClickUserHeaderWithPitModel:(QXRoomPitModel *)pitModel userModel:(id)userModel isPkRoom:(BOOL)isPkRoom pkRoomId:(NSString *)pkRoomId isNoTakeOff:(BOOL)isNoTakeOff{
if (isPkRoom) {
self.userInfoView.isCompere = NO;
self.userInfoView.isOwner = NO;
self.userInfoView.isManager = NO;
self.userInfoView.roomId = pkRoomId;
}else{
if (self.seatContentView.myPitNumber == 9 || self.roomModel.user_info.is_host.intValue == 1) {
self.userInfoView.isCompere = YES;
}else{
self.userInfoView.isCompere = NO;
}
if (self.roomModel.user_info.is_room_owner.intValue == 1) {
self.userInfoView.isOwner = YES;
}else{
self.userInfoView.isOwner = NO;
}
if (self.roomModel.user_info.is_management.intValue == 1) {
self.userInfoView.isManager = YES;
}else{
self.userInfoView.isManager = NO;
}
self.userInfoView.isNoTakeOff = isNoTakeOff;
self.userInfoView.roomId = self.roomModel.room_info.room_id;
}
if (pitModel) {
// self.userInfoView.isUpSeat = YES;
self.userInfoView.pitNumber = pitModel.pit_number;
self.userInfoView.userId = pitModel.user_id;
}else{
// self.userInfoView.isUpSeat = NO;
self.userInfoView.pitNumber = @"";
if ([userModel isKindOfClass:[QXRoomOwnerModel class]]) {
QXRoomOwnerModel*md = (QXRoomOwnerModel*)userModel;
self.userInfoView.userId = md.user_id;
}
}
[self.userInfoView showInView:self.view];
}
#pragma mark - QXRoomSettingViewDelegate
-(void)didClickSetModel:(QXRoomSettingModel *)model{
switch (model.type) {
case QXRoomSettingTypeRoomClearMessage:{
[[QXRoomMessageManager shared] sendChatMessage:@"" messageType:(QXRoomMessageTypeClearMessage) needInsertMessage:NO];
[self.chatListView clearMessage];
[self.settingView hide];
}
break;
case QXRoomSettingTypeRoomSetting:{
MJWeakSelf
QXCreateRoomViewController *vc = [[QXCreateRoomViewController alloc] init];
vc.roomModel = self.roomModel;
vc.editSucceessBlock = ^(QXRoomModel * _Nonnull roomModel) {
weakSelf.roomModel = roomModel;
};
[self.navigationController pushViewController:vc animated:YES];
[self.settingView hide];
}
break;
case QXRoomSettingTypeRoomBgImage:{
self.roomBgSetView.roomId = self.roomId;
[self.roomBgSetView showInView:self.view];
[self.settingView hide];
}
break;
case QXRoomSettingTypeRoomBgMusic:{
if (_musicView == nil) {
[self.musicView showInView:self.view];
}
MJWeakSelf
self.musicView.closeActionBlock = ^{
[weakSelf.musicView removeFromSuperview];
[[QXAgoraEngine sharedEngine] ktv_EndSing];
self->_musicView = nil;
};
self.musicView.moreActionBlock = ^{
weakSelf.songListView.isBgMusic = [QXAgoraEngine sharedEngine].isPlayBgMusic;
[weakSelf.songListView showInView:weakSelf.view];
};
self.musicView.nextActionBlock = ^{
[[QXAgoraEngine sharedEngine] nextBgMusic];
};
self.musicView.pauseActionBlock = ^(UIButton * _Nonnull playBtn) {
playBtn.selected = !playBtn.selected;
if (playBtn.isSelected) {
[[QXAgoraEngine sharedEngine] pausePlayMusic];
}else{
[[QXAgoraEngine sharedEngine] resumePlayMusic];
}
};
[self.settingView hide];
self.songListView.isBgMusic = [QXAgoraEngine sharedEngine].isPlayBgMusic;
[self.songListView showInView:self.view];
}
break;
case QXRoomSettingTypeRoomReport:{
QXReportViewController *reportVC = [[QXReportViewController alloc] init];
reportVC.reportType = @"2";
reportVC.fromId = self.roomId;
[self.navigationController pushViewController:reportVC animated:YES];
}
break;
case QXRoomSettingTypeRoomSubsidy:{
QXRoomSubsidyViewController *reportVC = [[QXRoomSubsidyViewController alloc] init];
reportVC.room_id = self.roomId;
[self.navigationController pushViewController:reportVC animated:YES];
}
break;
default:
break;
}
}
-(void)didClickHeadLine{
self.sendHeadLineView.isHeadline = YES;
MJWeakSelf
showLoadingInView(self.view);
[QXMineNetwork headlineInitSuccessBlock:^(NSDictionary * _Nonnull dict) {
hideLoadingInView(weakSelf.view);
NSString *countdown = [NSString stringWithFormat:@"%@",dict[@"countdown"]];
NSString *next_money = [NSString stringWithFormat:@"%@",dict[@"next_money"]];
NSString *now_money = [NSString stringWithFormat:@"%@",dict[@"now_money"]];
weakSelf.sendHeadLineView.coin = next_money;
weakSelf.sendHeadLineView.now_coin = now_money;
weakSelf.sendHeadLineView.minutes = countdown;
[weakSelf.sendHeadLineView showInView:weakSelf.view];
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
hideLoadingInView(weakSelf.view);
}];
}
-(void)soundAction{
[self.soundListView showInView:self.view];
}
#pragma mark - 用户信息查看后操作
-(void)didClickEventType:(QXRoomUserInfoViewEventType)evntType userModel:(nonnull QXRoomUserInfoModel *)userModel pitNumber:(nonnull NSString *)pitNumber{
switch (evntType) {
case QXRoomUserInfoViewEventTypeAtTA:{
// @TA
[self.bottomView atUserWithName:userModel.nickname];
}
break;
case QXRoomUserInfoViewEventTypeChat:{
// 聊天
[[QXGlobal shareGlobal] chatWithUserID:userModel.user_id nickname:userModel.nickname avatar:userModel.avatar navagationController:self.navigationController];
}
break;
case QXRoomUserInfoViewEventTypeGift:{
self.sendGiftView.type = QXSendGiftViewTypeRoom;
// 送礼物
if (self.sendGiftView.titles.count == 0) {
[self.sendGiftView reloadData];
}
QXRoomPitModel *model = [[QXRoomPitModel alloc] init];
model.pit_number = pitNumber;
model.user_id = userModel.user_id;
model.nickname = userModel.nickname;
model.avatar = userModel.avatar;
self.sendGiftView.userModel = model;
self.sendGiftView.roomId = self.userInfoView.roomId;
[self.sendGiftView showInView:self.view];
// [[QXGlobal shareGlobal] showView:self.sendGiftView controller:self popType:(PopViewTypeBottomToUpActionSheet) tapDismiss:YES finishBlock:^{
//
// }];
}
break;
default:
break;
}
}
-(void)sendGiftWithUser:(QXRoomPitModel *)user{
self.sendGiftView.type = QXSendGiftViewTypeRoom;
// 送礼物
if (self.sendGiftView.titles.count == 0) {
[self.sendGiftView reloadData];
}
QXRoomPitModel *model = [[QXRoomPitModel alloc] init];
model.pit_number = @"";
model.user_id = user.user_id;
model.nickname = user.nickname;
model.avatar = user.avatar;
self.sendGiftView.userModel = model;
self.sendGiftView.roomId = self.roomId;
[self.sendGiftView showInView:self.view];
// [[QXGlobal shareGlobal] showView:self.sendGiftView controller:self popType:(PopViewTypeBottomToUpActionSheet) tapDismiss:YES finishBlock:^{
//
// }];
}
#pragma - mark 麦位操作
-(void)upSeatAction{
// if (self.roomModel.room_info.room_up_pit_type.intValue == 1) {
// self.upSeatView.isCompere = (self.seatContentView.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1);
// self.upSeatView.roomId = self.roomId;
// [self.upSeatView showInView:self.view];
// }else{
BOOL isUpSeat = !self.upSeatBtn.selected;
[self upDownSeatNetworkWithPitNum:@"" isUpSeat:isUpSeat];
// }
}
-(void)micTeamAction{
self.upSeatView.isCompere = (self.seatContentView.myPitNumber == 9 || self.roomModel.user_info.is_room_owner.intValue == 1);
self.upSeatView.roomId = self.roomId;
[self.upSeatView showInView:self.view];
}
-(void)upDownSeatNetworkWithPitNum:(NSString*)pitNum isUpSeat:(BOOL)isUpSeat{
[QXMineNetwork roomUpSeatWithRoomId:self.roomId pit_number:pitNum isUpSeat:isUpSeat successBlock:^(NSDictionary * _Nonnull dict) {
} failBlock:^(NSError * _Nonnull error, NSString * _Nonnull msg) {
showToast(msg);
}];
}
-(QXRoomSeatView *)seatContentView{
if (!_seatContentView) {
_seatContentView = [[QXRoomSeatView alloc] initWithType:(QXRoomSeatViewTypeNone)];
_seatContentView.hidden = YES;
_seatContentView.delegate = self;
}
return _seatContentView;
}
-(QXRoomBottomView *)bottomView{
if (!_bottomView) {
_bottomView = [[QXRoomBottomView alloc] init];
_bottomView.delegate = self;
_bottomView.vc = self;
_bottomView.hidden = YES;
}
return _bottomView;
}
-(QXRoomChatListView *)chatListView{
if (!_chatListView) {
_chatListView = [[QXRoomChatListView alloc] init];
_chatListView.delegate = self;
}
return _chatListView;
}
- (QXRoomSongListView *)songListView{
if (!_songListView) {
_songListView = [[QXRoomSongListView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_songListView.roomId = self.roomId;
}
return _songListView;
}
- (QXSendGiftView *)sendGiftView{
if (!_sendGiftView) {
_sendGiftView = [[QXSendGiftView alloc] initWithType:QXSendGiftViewTypeRoom];
_sendGiftView.vc = self;
_sendGiftView.roomId = self.roomId;
// [_sendGiftView reloadData];
MJWeakSelf
_sendGiftView.roomSendSuccessBlock = ^(BOOL isAuction, QXGiftModel * _Nonnull giftModel, NSString * _Nonnull userId, NSString * _Nonnull auctionId) {
if (self->_continuousView == nil) {
[weakSelf.view addSubview:weakSelf.continuousView];
}
weakSelf.continuousView.giftModel = giftModel;
weakSelf.continuousView.isAuction = isAuction;
weakSelf.continuousView.userId = userId;
weakSelf.continuousView.auctionId = auctionId;
};
}
return _sendGiftView;
}
-(QXSoundListView *)soundListView{
if (!_soundListView) {
_soundListView = [[QXSoundListView alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
return _soundListView;
}
-(UIButton *)soundBtn{
if (!_soundBtn) {
_soundBtn = [[UIButton alloc] init];
[_soundBtn setImage:[UIImage imageNamed:@"room_sound"] forState:(UIControlStateNormal)];
[_soundBtn addTarget:self action:@selector(soundAction) forControlEvents:(UIControlEventTouchUpInside)];
// _soundBtn.hidden = YES;
}
return _soundBtn;
}
-(UIButton *)upSeatBtn{
if (!_upSeatBtn) {
_upSeatBtn = [[UIButton alloc] init];
_upSeatBtn.needEventInterval = 0.5;
[_upSeatBtn setImage:[UIImage imageNamed:@"room_upseat"] forState:(UIControlStateNormal)];
[_upSeatBtn setImage:[UIImage imageNamed:@"room_downseat"] forState:(UIControlStateSelected)];
[_upSeatBtn addTarget:self action:@selector(upSeatAction) forControlEvents:(UIControlEventTouchUpInside)];
}
return _upSeatBtn;
}
-(QXUpSeatView *)upSeatView{
if (!_upSeatView) {
_upSeatView = [[QXUpSeatView alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
return _upSeatView;
}
#pragma mark - 特效
- (UIView *)bgEffectView {
if (!_bgEffectView) {
_bgEffectView = [[QXGiftPlayerManager shareManager] defaultBgEffectView];
}
return _bgEffectView;
}
-(QXRoomSettingView *)settingView{
if (!_settingView) {
_settingView = [[QXRoomSettingView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_settingView.delegate = self;
}
return _settingView;
}
-(QXRoomBgSettingView *)roomBgSetView{
if (!_roomBgSetView) {
_roomBgSetView = [[QXRoomBgSettingView alloc] initWithFrame:[UIScreen mainScreen].bounds];
}
return _roomBgSetView;
}
-(QXRoomBgMusicView *)musicView{
if (!_musicView) {
_musicView = [[QXRoomBgMusicView alloc] init];
}
return _musicView;
}
-(QXRoomUserInfoView *)userInfoView{
if (!_userInfoView) {
_userInfoView = [[QXRoomUserInfoView alloc] initWithFrame:[UIScreen mainScreen].bounds];
_userInfoView.delegate = self;
}
return _userInfoView;
}
-(QXHeadlineView *)headlineView{
if (!_headlineView) {
MJWeakSelf
_headlineView = [[QXHeadlineView alloc] init];
_headlineView.getHeadlineBlock = ^{
[weakSelf didClickHeadLine];
};
}
return _headlineView;
}
-(QXDirectSetScaleView *)sendHeadLineView{
if (!_sendHeadLineView) {
_sendHeadLineView = [[QXDirectSetScaleView alloc] init];
_sendHeadLineView.roomId = self.roomId;
}
return _sendHeadLineView;
}
-(QXRoomPKSearchView *)pkSearchView{
if (!_pkSearchView) {
_pkSearchView = [[QXRoomPKSearchView alloc] init];
}
return _pkSearchView;
}
-(QXCabinMovieView *)movieView{
if (!_movieView) {
_movieView = [[QXCabinMovieView alloc] init];
}
return _movieView;
}
-(QXContinuousGiftView *)continuousView{
if (!_continuousView) {
MJWeakSelf
_continuousView = [[QXContinuousGiftView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH-65-12, SCREEN_HEIGHT-70-78-52-34-20-70, 65, 65)];
_continuousView.roomId = self.roomId;
_continuousView.dissMissBlock = ^(QXGiftModel * _Nonnull gift) {
[weakSelf.continuousView removeFromSuperview];
self->_continuousView = nil;
};
}
return _continuousView;
}
-(QXUpSeatCountView *)micTeamView{
if (!_micTeamView) {
_micTeamView = [[QXUpSeatCountView alloc] init];
MJWeakSelf
[_micTeamView addTapBlock:^(id _Nonnull obj) {
[weakSelf micTeamAction];
}];
// _micTeamView.needEventInterval = 0.5;
// [_micTeamView setImage:[UIImage imageNamed:@"room_mic_team"] forState:(UIControlStateNormal)];
// [_micTeamView addTarget:self action:@selector(micTeamAction) forControlEvents:(UIControlEventTouchUpInside)];
}
return _micTeamView;
}
//
@end