Files
midi_ios/QXLive/HomePage(声播)/Controlller/房间/QXRoomViewController.m

1970 lines
81 KiB
Mathematica
Raw Normal View History

2025-08-14 10:07:49 +08:00
//
// QXRoomViewController.m
// QXLive
//
// Created by on 2025/6/7.
//
#import "QXRoomViewController.h"
#import "QXRoomSongListView.h"
#import "QXSoundListView.h"
#import "QXUpSeatView.h"
#import "QXMineNetwork.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"
2025-08-22 19:02:44 +08:00
#import "QXRoomViewController+Friend.h"
2025-09-29 17:21:49 +08:00
#import "QXAllRoomHourRankView.h"
2025-10-12 15:48:35 +08:00
#import "QXRedBagSendView.h"
#import "QXRedBagTagView.h"
#import "QXRedBagDrawView.h"
#import "QXRedBagListView.h"
2025-08-14 10:07:49 +08:00
@interface QXRoomViewController ()<
QXRoomBottomViewDelegate,
QXRoomSettingViewDelegate,
QXAgoraEngineMediaPlayerDelegate,
QXRoomUserInfoViewDelegate
>
@property (nonatomic,strong)UIImageView *roomBgImageView;
@property (nonatomic,strong)UIView *roomBgCoverView;
/// view
@property (nonatomic,strong)QXRoomSongListView *songListView;
///
@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)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;
2025-09-29 17:21:49 +08:00
@property (nonatomic,strong)QXAllRoomHourRankView *hourRankView;
@property (nonatomic,strong)QXAllRoomHourRankTagView *hourRankIconView;
2025-10-12 15:48:35 +08:00
///
@property (nonatomic,strong)QXRedBagTagView *redBagTagView;
@property (nonatomic,strong)QXRedBagDrawView *redbagDrawView;
@property (nonatomic,strong)QXRedBagListView *redbagListView;
2025-08-14 10:07:49 +08:00
@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];
2025-09-22 14:58:13 +08:00
2025-08-14 10:07:49 +08:00
}
-(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;
}
}
2025-09-22 14:58:13 +08:00
[self playHWDMP4];
2025-09-24 09:14:50 +08:00
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[[QXGiftPlayerManager shareManager] startPlay];
});
2025-08-14 10:07:49 +08:00
self.navigationController.viewControllers = marr;
// self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
-(void)viewDidDisappear:(BOOL)animated{
[super viewDidDisappear:animated];
2025-09-19 11:38:43 +08:00
// [[QXGiftPlayerManager shareManager] stopPlay];
2025-08-14 10:07:49 +08:00
self.continuousView.hidden = YES;
2025-09-22 14:58:13 +08:00
[self stopHWDMP4];
2025-09-24 09:14:50 +08:00
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
[[QXGiftPlayerManager shareManager] stopPlay];
2025-08-14 10:07:49 +08:00
}
-(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];
}
2025-09-29 17:21:49 +08:00
[self.view addSubview:self.hourRankIconView];
2025-10-12 15:48:35 +08:00
// [self.view addSubview:self.redBagTagView];
2025-08-14 10:07:49 +08:00
[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];
}
2025-09-19 11:38:43 +08:00
-(void)setRoomModel:(QXRoomModel *)roomModel{
_roomModel = roomModel;
}
-(void)setRoomId:(NSString *)roomId{
_roomId = roomId;
2025-08-14 10:07:49 +08:00
[self.chatListView insertNoitce];
MJWeakSelf
[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) {
}];
2025-09-19 11:38:43 +08:00
}
#pragma mark -
-(void)joinRoom{
2025-09-24 09:14:50 +08:00
if (self.roomModel) {
[self resetSubviews];
[self configRoomDataIsJoin:YES];
}else{
MJWeakSelf
[[QXRoomMessageManager shared] joinGroupWithRoomId:self.roomId];
[QXMineNetwork joinRoomWithRoomId:self.roomId successBlock:^(QXRoomModel * _Nonnull roomModel) {
weakSelf.roomModel = roomModel;
[self resetSubviews];
[self 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];
});
}];
}
2025-09-19 11:38:43 +08:00
//// roomModel.room_info.pk_room_id = @"33";
//
//
// } 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];
// });
//
// }];
2025-08-14 10:07:49 +08:00
}
-(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"];
}
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) {
2025-08-14 10:07:49 +08:00
//
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];
2025-08-22 19:02:44 +08:00
}else if (self.roomModel.room_info.type_id.intValue == 7) {
///
[self resetFriendViews];
2025-08-14 10:07:49 +08:00
}
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];
}
}
2025-09-29 17:21:49 +08:00
if (self.roomModel.gift_cycle.xlh_info.xlh_status.intValue == 1) {
self.acTagView.end_time = self.roomModel.gift_cycle.xlh_info.end_time;
[self.view addSubview:self.acTagView];
}else{
[self.acTagView stopTimer];
[self.acTagView removeFromSuperview];
}
2025-09-30 19:42:20 +08:00
if (self.roomModel.hour_ranking_open == 1) {
self.hourRankIconView.hidden = NO;
}else{
self.hourRankIconView.hidden = YES;
}
2025-08-14 10:07:49 +08:00
}
-(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;
2025-09-08 08:49:04 +08:00
if (self.roomModel.room_info.type_id.intValue == 6) {
self.bottomView.isCabinRoom = YES;
2025-08-14 10:07:49 +08:00
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES];
}else{
2025-09-08 08:49:04 +08:00
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];
}
2025-08-14 10:07:49 +08:00
}
self.seatContentView.roomModel = self.roomModel;
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2){
2025-08-14 10:07:49 +08:00
/// 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:^{
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && weakSelf.roomModel.room_info.label_id.intValue == 2) {
2025-08-14 10:07:49 +08:00
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];
2025-09-08 08:49:04 +08:00
[[QXAgoraEngine sharedEngine] setClientRoleBroadcaster:YES];
[[QXAgoraEngine sharedEngine] enableAudio:NO];
[[QXAgoraEngine sharedEngine] muteLocalAudioStream:NO];
2025-08-14 10:07:49 +08:00
}
}];
}else{
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2) {
2025-08-14 10:07:49 +08:00
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;
2025-09-08 08:49:04 +08:00
2025-08-14 10:07:49 +08:00
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) {
2025-08-14 10:07:49 +08:00
//
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{
2025-09-08 08:49:04 +08:00
if (self.roomModel.room_info.type_id.intValue == 6) {
self.bottomView.isCabinRoom = YES;
return;
}
2025-08-14 10:07:49 +08:00
self.bottomView.roomModel = self.roomModel;
BOOL hasPK = NO;
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 1) {
2025-08-14 10:07:49 +08:00
hasPK = YES;
}
2025-08-22 19:02:44 +08:00
BOOL hasSong = NO;
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8){
2025-08-22 19:02:44 +08:00
hasSong = YES;
2025-08-14 10:07:49 +08:00
}
2025-09-15 18:20:22 +08:00
/// pk
hasPK = NO;
2025-09-22 14:58:13 +08:00
/// ktv
hasSong = NO;
2025-08-14 10:07:49 +08:00
///
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{
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 2) {
2025-08-14 10:07:49 +08:00
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];
}
}
2025-09-22 14:58:13 +08:00
-(void)roomSeatExchangedWithFromPitNumber:(NSInteger)fromPitNumber toPitNumber:(NSInteger)toPitNumber userInfo:(QXUserHomeModel*)userInfo{
[self.seatContentView roomSeatExchangedWithFromPitNumber:fromPitNumber toPitNumber:toPitNumber userInfo:userInfo];
if ([userInfo.user_id isEqualToString:QXGlobal.shareGlobal.loginModel.user_id]) {
if (toPitNumber == 9) {
self.soundBtn.hidden = NO;
self.titleView.isCompere = YES;
}else{
self.soundBtn.hidden = YES;
self.titleView.isCompere = NO;
}
}
2025-09-08 08:49:04 +08:00
}
2025-08-14 10:07:49 +08:00
//
-(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];
}
2025-09-11 18:25:41 +08:00
-(void)roomClearUserCharmWithUserId:(NSString *)userId{
[self.seatContentView roomClearUserCharmWithUserId:userId];
}
2025-08-14 10:07:49 +08:00
///
-(void)didRecieveGiftWithWithUserInfo:(QXUserHomeModel *)userInfo{
[self.seatContentView setSeatCharmWithUser:userInfo];
}
2025-09-19 11:38:43 +08:00
-(void)didRecieveGiftWithWithUserInfos:(NSArray<QXUserHomeModel *> *)userInfos{
[self.seatContentView setSeatCharmWithUsers:userInfos];
}
2025-08-14 10:07:49 +08:00
///
-(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;
2025-09-19 11:38:43 +08:00
[self.view addSubview:self.headlineView];
2025-08-14 10:07:49 +08:00
}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) {
///
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 1) {
2025-08-14 10:07:49 +08:00
// 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];
}
break;
case QXRoomBottomViewEventTypePK:{
self.pkSearchView.roomId = self.roomModel.room_info.room_id;
[self.pkSearchView showInView:self.view];
}
break;
case QXRoomBottomViewEventTypeMusic:{
2025-09-19 11:38:43 +08:00
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.type_id.intValue == 8) && self.roomModel.room_info.label_id.intValue == 1){
2025-08-14 10:07:49 +08:00
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]) {
2025-09-19 11:38:43 +08:00
md.isSelected = NO;
2025-08-14 10:07:49 +08:00
[pitArr addObject:md];
QXRoomPitModel *lastMd = self.roomModel.room_info.pit_list[9];
2025-09-11 18:25:41 +08:00
if (lastMd.user_id.longValue > 0 && ![QXGlobal.shareGlobal.loginModel.user_id isEqualToString:lastMd.user_id]) {
2025-09-19 11:38:43 +08:00
lastMd.isSelected = NO;
2025-08-14 10:07:49 +08:00
[pitArr addObject:lastMd];
}
}else{
QXRoomPitModel *lastMd = self.roomModel.room_info.pit_list[9];
2025-09-11 18:25:41 +08:00
if (lastMd.user_id.longValue > 0 && ![QXGlobal.shareGlobal.loginModel.user_id isEqualToString:lastMd.user_id]) {
2025-09-19 11:38:43 +08:00
lastMd.isSelected = NO;
2025-08-14 10:07:49 +08:00
[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;
2025-09-11 18:25:41 +08:00
if ([self.roomModel.room_info.type_id isEqualToString:@"2"]) {
///
if ([md.user_id isEqualToString:self.roomModel.room_auction.auction_user.user_id]) {
continue;
}
2025-08-14 10:07:49 +08:00
}
if (md.pit_number.intValue == 9) {
compereModel = md;
2025-09-15 18:20:22 +08:00
if (md.user_id.longValue > 0 && ![md.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[pitArr insertObject:md atIndex:0];
}
2025-08-14 10:07:49 +08:00
continue;
}else if (md.pit_number.intValue == 10) {
guestModel = md;
continue;
}
2025-09-11 18:25:41 +08:00
if (md.user_id.longValue > 0 && ![md.user_id isEqualToString:[QXGlobal shareGlobal].loginModel.user_id]) {
[pitArr addObject:md];
}
2025-08-14 10:07:49 +08:00
}
2025-09-15 18:20:22 +08:00
2025-08-14 10:07:49 +08:00
}
// 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";
2025-09-19 11:38:43 +08:00
md.isSelected = NO;
2025-08-14 10:07:49 +08:00
[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]) {
2025-09-19 11:38:43 +08:00
md.isSelected = NO;
2025-08-14 10:07:49 +08:00
[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";
2025-09-19 11:38:43 +08:00
md.isSelected = NO;
2025-08-14 10:07:49 +08:00
[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]) {
2025-09-19 11:38:43 +08:00
md.isSelected = NO;
2025-08-14 10:07:49 +08:00
[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;
}
}
2025-10-12 15:48:35 +08:00
-(void)didSendMessage:(NSString *)message redpacketModel:(nonnull QXRedPacketModel *)redpacketModel{
if (redpacketModel) {
self.redbagDrawView.type = QXRedBagDrawTypeOpen;
[self.redbagDrawView showInView:self.view];
}
2025-08-14 10:07:49 +08:00
}
2025-10-12 15:48:35 +08:00
2025-08-14 10:07:49 +08:00
#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;
2025-10-12 15:48:35 +08:00
case QXRoomSettingTypeSendRedBag:{
QXRedBagSendView *redbagView = [[QXRedBagSendView alloc] init];
[redbagView showInView:self.view];
}
break;
2025-08-14 10:07:49 +08:00
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
2025-09-15 18:20:22 +08:00
_sendGiftView.roomSendSuccessBlock = ^(QXSendGiftViewType sendType, QXGiftModel * _Nonnull giftModel, NSString * _Nonnull giftCount, NSString * _Nonnull userId, NSString * _Nonnull optionId) {
2025-09-11 18:25:41 +08:00
// if (self->_continuousView == nil) {
2025-08-14 10:07:49 +08:00
[weakSelf.view addSubview:weakSelf.continuousView];
2025-09-11 18:25:41 +08:00
// }
2025-08-14 10:07:49 +08:00
weakSelf.continuousView.giftModel = giftModel;
2025-08-22 19:02:44 +08:00
weakSelf.continuousView.sendType = sendType;
2025-08-14 10:07:49 +08:00
weakSelf.continuousView.userId = userId;
2025-09-15 18:20:22 +08:00
weakSelf.continuousView.giftCount = giftCount;
2025-08-22 19:02:44 +08:00
switch (sendType) {
case QXSendGiftViewTypeFriend:{
weakSelf.continuousView.heartId = optionId;
weakSelf.continuousView.auctionId = @"";
}
break;
case QXSendGiftViewTypeAuction:{
weakSelf.continuousView.auctionId = optionId;
weakSelf.continuousView.heartId = @"";
}
break;
default:
break;
}
2025-08-14 10:07:49 +08:00
};
2025-09-08 08:49:04 +08:00
_sendGiftView.jumpActivityGiftBlock = ^(QXGiftModel * _Nonnull gift, NSString * _Nonnull userIds) {
if (gift.gift_bag.intValue == 10) {
weakSelf.skyView.giftModel = gift;
weakSelf.skyView.roomId = weakSelf.roomId;
weakSelf.skyView.userIds = userIds;
2025-09-11 18:25:41 +08:00
weakSelf.skyView.heartId = weakSelf.sendGiftView.heartId;
2025-10-12 15:56:48 +08:00
weakSelf.skyView.auctionId = weakSelf.sendGiftView.auctionId;
2025-10-04 18:31:00 +08:00
if (weakSelf.sendGiftView.type == QXSendGiftViewTypeAuction) {
weakSelf.skyView.heartId = @"";
weakSelf.skyView.auctionId = weakSelf.sendGiftView.auctionId;
}
2025-09-08 08:49:04 +08:00
[weakSelf.sendGiftView hide];
[weakSelf.skyView showInView:weakSelf.view];
}else if(gift.gift_bag.intValue == 11) {
weakSelf.ageView.giftModel = gift;
weakSelf.ageView.roomId = weakSelf.roomId;
weakSelf.ageView.userIds = userIds;
2025-09-11 18:25:41 +08:00
weakSelf.ageView.heartId = weakSelf.sendGiftView.heartId;
2025-10-12 15:56:48 +08:00
weakSelf.ageView.auctionId = weakSelf.sendGiftView.auctionId;
2025-10-04 18:31:00 +08:00
if (weakSelf.sendGiftView.type == QXSendGiftViewTypeAuction) {
weakSelf.skyView.heartId = @"";
weakSelf.skyView.auctionId = weakSelf.sendGiftView.auctionId;
}
2025-09-08 08:49:04 +08:00
[weakSelf.sendGiftView hide];
[weakSelf.ageView showInView:weakSelf.view];
}else if(gift.gift_bag.intValue == 12) {
weakSelf.timeView.giftModel = gift;
weakSelf.timeView.roomId = weakSelf.roomId;
weakSelf.timeView.userIds = userIds;
2025-09-11 18:25:41 +08:00
weakSelf.timeView.heartId = weakSelf.sendGiftView.heartId;
2025-10-12 15:56:48 +08:00
weakSelf.timeView.auctionId = weakSelf.sendGiftView.auctionId;
2025-10-04 18:31:00 +08:00
if (weakSelf.sendGiftView.type == QXSendGiftViewTypeAuction) {
weakSelf.skyView.heartId = @"";
weakSelf.skyView.auctionId = weakSelf.sendGiftView.auctionId;
}
2025-09-08 08:49:04 +08:00
[weakSelf.sendGiftView hide];
[weakSelf.timeView showInView:weakSelf.view];
}
};
2025-08-14 10:07:49 +08:00
}
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;
}
2025-09-08 08:49:04 +08:00
-(QXSkyPraizeView *)skyView{
if (!_skyView) {
_skyView = [[QXSkyPraizeView alloc] init];
MJWeakSelf
_skyView.startBlock = ^{
[weakSelf.skyView hide];
weakSelf.meetView.roomId = weakSelf.roomId;
[weakSelf.meetView showInView:weakSelf.view];
};
}
return _skyView;
}
-(QXAgePraizeView *)ageView{
if (!_ageView) {
_ageView = [[QXAgePraizeView alloc] init];
MJWeakSelf
_ageView.startBlock = ^{
[weakSelf.ageView hide];
weakSelf.meetView.roomId = weakSelf.roomId;
[weakSelf.meetView showInView:weakSelf.view];
};
}
return _ageView;
}
-(QXTimePraizeView *)timeView{
if (!_timeView) {
_timeView = [[QXTimePraizeView alloc] init];
MJWeakSelf
_timeView.startBlock = ^{
[weakSelf.timeView hide];
weakSelf.meetView.roomId = weakSelf.roomId;
[weakSelf.meetView showInView:weakSelf.view];
};
}
return _timeView;
}
2025-09-29 17:21:49 +08:00
-(QXActivityTagView *)acTagView{
if (!_acTagView) {
_acTagView = [[QXActivityTagView alloc] init];
MJWeakSelf
_acTagView.startBlock = ^{
[weakSelf.skyView hide];
weakSelf.meetView.roomId = weakSelf.roomId;
[weakSelf.meetView showInView:weakSelf.view];
};
}
return _acTagView;
}
2025-09-08 08:49:04 +08:00
-(QXMeetActivityView *)meetView{
if (!_meetView) {
_meetView = [[QXMeetActivityView alloc] init];
_meetView.roomId = self.roomId;
}
return _meetView;
}
2025-09-22 14:58:13 +08:00
-(void)stopHWDMP4{
[self.seatContentView stopHWDMP4];
}
-(void)playHWDMP4{
[self.seatContentView playHWDMP4];
}
2025-09-08 08:49:04 +08:00
-(void)destroyViews{
if (_skyView) {
[_skyView destroyViews];
_skyView = nil;
}
if (_ageView) {
[_ageView destroyViews];
_ageView = nil;
}
if (_timeView) {
[_timeView destroyViews];
_timeView = nil;
}
}
2025-09-29 17:21:49 +08:00
-(QXAllRoomHourRankTagView *)hourRankIconView{
if (!_hourRankIconView) {
_hourRankIconView = [[QXAllRoomHourRankTagView alloc] init];
MJWeakSelf
_hourRankIconView.startBlock = ^{
[weakSelf.hourRankView showInView:weakSelf.view];
};
2025-09-30 19:42:20 +08:00
_hourRankIconView.hidden = YES;
2025-09-29 17:21:49 +08:00
}
return _hourRankIconView;
}
-(QXAllRoomHourRankView *)hourRankView{
if (!_hourRankView) {
_hourRankView = [[QXAllRoomHourRankView alloc] init];
}
return _hourRankView;
}
2025-10-12 15:48:35 +08:00
-(QXRedBagTagView *)redBagTagView{
if (!_redBagTagView) {
_redBagTagView = [[QXRedBagTagView alloc] init];
MJWeakSelf
_redBagTagView.startBlock = ^(BOOL isList) {
weakSelf.redbagListView.dataArray = @[@"",@"",@"",@"",@""];
[weakSelf.redbagListView showInView:weakSelf.view];
return;
if (isList) {
[weakSelf.redbagListView showInView:weakSelf.view];
}else{
[weakSelf.redbagDrawView showInView:weakSelf.view];
}
};
}
return _redBagTagView;
}
-(QXRedBagDrawView *)redbagDrawView{
if (!_redbagDrawView) {
_redbagDrawView = [[QXRedBagDrawView alloc] init];
MJWeakSelf
_redbagDrawView.toInputPwdBlock = ^(NSString * _Nonnull password, QXRedPacketModel * _Nonnull redpacketModel) {
[weakSelf.bottomView inputMessageWithName:password redpacketModel:redpacketModel];
};
}
return _redbagDrawView;
}
-(QXRedBagListView *)redbagListView{
if (!_redbagListView) {
_redbagListView = [[QXRedBagListView alloc] init];
MJWeakSelf
_redbagListView.didSelectedRedBlock = ^{
weakSelf.redbagDrawView.redpacketModel = [QXRedPacketModel new];
weakSelf.redbagDrawView.type = QXRedBagDrawTypePwdSend;
[weakSelf.redbagDrawView showInView:weakSelf.view];
};
}
return _redbagListView;
}
2025-08-14 10:07:49 +08:00
@end