3161 lines
125 KiB
Mathematica
3161 lines
125 KiB
Mathematica
|
|
//
|
|||
|
|
// RCMicRoomViewController.m
|
|||
|
|
// SealMic
|
|||
|
|
//
|
|||
|
|
// Created by lichenfeng on 2020/5/26.
|
|||
|
|
// Copyright © 2020 rongcloud. All rights reserved.
|
|||
|
|
//
|
|||
|
|
#import "RCMicRoomViewController.h"
|
|||
|
|
#import "RCMicRoomNavigationView.h"
|
|||
|
|
#import "RCMicUtil.h"
|
|||
|
|
#import "RCMicMacro.h"
|
|||
|
|
#import "RCMicParticipantsArea.h"
|
|||
|
|
#import "RCMicChatView.h"
|
|||
|
|
#import "RCMicInputBar.h"
|
|||
|
|
#import "RCMicRoomToolBar.h"
|
|||
|
|
#import "RCMicBlinkExcelView.h"
|
|||
|
|
#import "RCMicActiveWheel.h"
|
|||
|
|
#import "BJMicRoomOperationAlert.h"
|
|||
|
|
#import "BJRoomGiftAlert.h"
|
|||
|
|
#import "BJRoomGiftModel.h"
|
|||
|
|
#import "BJRoomBaomaiAlert.h"
|
|||
|
|
#import "BJRoomBaomaiModel.h"
|
|||
|
|
#import "BJRoomSetAdminiCtrl.h"
|
|||
|
|
#import "BJRoomEmojiAlert.h"
|
|||
|
|
#import "BJFlyWordManager.h"
|
|||
|
|
#import "BJFloatRoomManager.h"
|
|||
|
|
#import "RoomBotMoreView.h"
|
|||
|
|
#import <HWPopController/HWPop.h>
|
|||
|
|
#import "MH_ZhuanZengView.h"
|
|||
|
|
#import "WebSocketManager.h"
|
|||
|
|
//公屏筛选
|
|||
|
|
#import "RoomPublicSelectView.h"
|
|||
|
|
#import "BJRoomSetChaoguanCtrl.h"
|
|||
|
|
#import "KNActionSheet.h"
|
|||
|
|
#import "RoomNoticeAlertView.h"
|
|||
|
|
#import "AmPKVC.h"
|
|||
|
|
#import "PklineView.h"
|
|||
|
|
#import "SPRoomPeopleAlert.h"
|
|||
|
|
#import "SPRoomTop3View.h"
|
|||
|
|
#import "TXMessageVC.h"
|
|||
|
|
#import "YYRoomSettingVC.h"
|
|||
|
|
#import "YYRoomRankVC.h"
|
|||
|
|
#import "YYJYApplyUpView.h"
|
|||
|
|
#import "YYRoomCPRankView.h"
|
|||
|
|
#import "YYKTVChujiaInfoView.h"
|
|||
|
|
#import "YYKTVCenterView.h"
|
|||
|
|
#import "RoomSongSettingView.h"
|
|||
|
|
#import "RoomSongView.h"
|
|||
|
|
#import "UIButton+BAKit.h"
|
|||
|
|
#import "YYRoomInviteAlert.h"
|
|||
|
|
#import "YYQianyueSelfAlert.h"
|
|||
|
|
#import "YYQianyueSuccessAlert.h"
|
|||
|
|
#import "YYJYRelationView.h"
|
|||
|
|
#import "YYJYSimiRoomView.h"
|
|||
|
|
#import "YYJYPendantGiftView.h"
|
|||
|
|
#import "UIView+VAP.h"
|
|||
|
|
#import "QGVAPWrapView.h"
|
|||
|
|
#import "QGVAPWrapView+download.h"
|
|||
|
|
#import "RoomMusicView.h"
|
|||
|
|
#import "YYPMSelfAlert.h"
|
|||
|
|
#import "YYPMSuccessAlert.h"
|
|||
|
|
#import "YYRoomChujiaAlert.h"
|
|||
|
|
#import "YYKTVTipsAlert.h"
|
|||
|
|
#import "YYXinrenTop3View.h"
|
|||
|
|
#import "YYPMPickRelationView.h"
|
|||
|
|
#import "SweetParty-Bridging-Header.h"
|
|||
|
|
#import "Yinyue-Swift.h"
|
|||
|
|
#import "GiftTableView.h"
|
|||
|
|
#import "SEARoomHeadlineShowView.h"
|
|||
|
|
#import "SEARoomHeadlinesPublishView.h"
|
|||
|
|
#import <IQKeyboardManager/IQKeyboardManager.h>
|
|||
|
|
#import "LMLoveSkyWheelViewController.h"
|
|||
|
|
#import "LMCPInRoomVapView.h"
|
|||
|
|
#import "RCMicRoomViewController+Game.h"
|
|||
|
|
#import "YYRoomGamePickView.h"
|
|||
|
|
#import "YYXQInviteAlert.h"
|
|||
|
|
#import "LMRoomBlackListViewController.h"
|
|||
|
|
#import "BlindXunlehuiShowView.h"
|
|||
|
|
#import "ZWTimer.h"
|
|||
|
|
|
|||
|
|
#define InputBarHeight 50
|
|||
|
|
#define ToolBarHeight 40
|
|||
|
|
#define ResponseWaiting 15
|
|||
|
|
|
|||
|
|
@interface RCMicRoomViewController ()<RCMicRoomNavigationViewDelegate, RCMicRoomToolBarDelegate, RCMicParticipantsAreaDelegate, RCMicInputBarControlDelegate, RCMicChatViewDelegate, UIGestureRecognizerDelegate, BJMicRoomOperationAlertDelegate, HWDMP4PlayDelegate, VAPWrapViewDelegate, AgoraLrcViewDelegate, AgoraLogDelegate, AgoraLrcDownloadDelegate,ZWTimerDelegate>
|
|||
|
|
@property (nonatomic, strong) RCMicRoomViewModel *viewModel;
|
|||
|
|
@property (nonatomic, strong) UIImageView *backgroundView;
|
|||
|
|
@property (nonatomic, strong) UITapGestureRecognizer *tapGesture;
|
|||
|
|
@property (nonatomic, strong) RCMicRoomNavigationView *customNavigationView;//导航栏
|
|||
|
|
@property (nonatomic, strong) RCMicRoomToolBar *customToolBar;//底部工具栏
|
|||
|
|
@property (nonatomic, strong) RoomPublicSelectView *publicSelectView;//底部工具栏
|
|||
|
|
@property (nonatomic, strong) RCMicParticipantsArea *participantsArea;//麦位区域
|
|||
|
|
@property (nonatomic, strong) RCMicChatView *chatView;//聊天区域
|
|||
|
|
@property (nonatomic, strong) RCMicInputBar *inputBar;//输入框
|
|||
|
|
@property (nonatomic, strong) RCMicBlinkExcelView *blinkExcelView;//debug 模式展示数据展示区域
|
|||
|
|
@property (nonatomic, strong) PklineView *pkView;
|
|||
|
|
@property (nonatomic, strong) UIButton *stopPkBtn;
|
|||
|
|
@property (nonatomic, strong) SPRoomTop3View *top3View;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) UIButton *rankBtn;
|
|||
|
|
@property (nonatomic, strong) UIImageView *meiliImgView;
|
|||
|
|
@property (nonatomic, strong) UIButton *room_noticeBtn;
|
|||
|
|
@property (nonatomic, strong) UIButton *descBtn; // 交友厅玩法说明
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) NSIndexPath *currentBgSoundIndexPath;//当前房间伴音选择项纪录
|
|||
|
|
@property (nonatomic, strong) NSTimer *wheelDismissTimer;//控制主持人转让相关操作页面弹出的转轮
|
|||
|
|
@property (nonatomic, assign) BOOL joinRoomSuccess;//是否已成功加入房间
|
|||
|
|
@property (nonatomic, assign) BOOL kvSyncSuccess;//是否已完成 IM 聊天室 KV 信息同步
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) BJMicRoomOperationAlert *operationAlert; //点击麦位的弹框
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) BJRoomGiftAlert *roomGiftView; //礼物弹框
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) BJRoomBaomaiAlert *userAlert; //抱麦弹框
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) BJRoomEmojiAlert *emojiAlert; //表情弹框
|
|||
|
|
|
|||
|
|
//@property(nonatomic, strong) RoomBotMoreView *botMoreView;//更多功能
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) BOOL isTotalQuitRoom;
|
|||
|
|
|
|||
|
|
@property (nonatomic,strong) YYRoomRankVC *bangdanVC;
|
|||
|
|
@property (nonatomic,strong) UIView *bangdanBgView;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) UIButton *applyUpBtn;
|
|||
|
|
@property (nonatomic, strong) UILabel *applyUpNumLab;
|
|||
|
|
@property (nonatomic, strong) YYJYApplyUpView *jyApplyUpV;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) YYXinrenTop3View *xrTop3View;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) YYJYRelationView *jyRelationV;
|
|||
|
|
@property (nonatomic, strong) YYJYSimiRoomView *simiRoomV;
|
|||
|
|
@property (nonatomic, strong) YYJYPendantGiftView *pendantGiftV;
|
|||
|
|
@property (nonatomic, strong) BlindXunlehuiShowView *blindShowV;
|
|||
|
|
@property (nonatomic, strong) QGVAPWrapView *jySimiVapView;
|
|||
|
|
|
|||
|
|
@property (nonatomic, assign) NSInteger leftSecond;
|
|||
|
|
@property (nonatomic, strong) ZWTimer *timer;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) UIButton *ktvStartBtn;
|
|||
|
|
@property (nonatomic, strong) UIButton *ktvNextBtn;
|
|||
|
|
@property (nonatomic, strong) UIButton *ktvDiangeBtn;
|
|||
|
|
@property (nonatomic, strong) YYKTVChujiaInfoView *ktvChujiaInfoV;
|
|||
|
|
@property (nonatomic, strong) YYKTVCenterView *ktvCenterV;
|
|||
|
|
@property (nonatomic, strong) UIButton *ktvTiaoyinBtn;
|
|||
|
|
@property (nonatomic, strong) RoomSongView *songListV;
|
|||
|
|
@property (nonatomic, strong) RoomSongSettingView *songSettingV;
|
|||
|
|
@property (nonatomic, strong) AgoraLrcScoreView *lrcView;
|
|||
|
|
//当前唱歌或签约用户ID
|
|||
|
|
@property (nonatomic, copy) NSString *ktvCurrentUid;
|
|||
|
|
@property (nonatomic, copy) NSString *ktvZhizuoUid;
|
|||
|
|
|
|||
|
|
@property(nonatomic, assign) CGFloat startX;
|
|||
|
|
@property(nonatomic, assign) BOOL bMove;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) RoomMusicView *musicView;
|
|||
|
|
|
|||
|
|
//麦位弹框私聊ID
|
|||
|
|
@property (nonatomic, copy) NSString *siliaoId;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) GiftTableView *lianjiView;
|
|||
|
|
@property (nonatomic, strong) QGVAPWrapView *luckyVapView;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) SEARoomHeadlineShowView *headlineShowView;
|
|||
|
|
@property (nonatomic, strong) ZWTimer *GBTimer;
|
|||
|
|
@property (nonatomic, assign) NSInteger endTime;
|
|||
|
|
|
|||
|
|
@property (nonatomic, strong) LMCPInRoomVapView *cpvapView;
|
|||
|
|
|
|||
|
|
/// 游戏加载主view
|
|||
|
|
@property (nonatomic, strong) UIView *gameView;
|
|||
|
|
/// SudMGP SDK加载业务参数
|
|||
|
|
@property (nonatomic, strong) SudMGPLoadConfigModel *sudMGPLoadConfigModel;
|
|||
|
|
@property (nonatomic, strong) YYRoomGamePickView *gamePickView;
|
|||
|
|
|
|||
|
|
@end
|
|||
|
|
|
|||
|
|
@implementation RCMicRoomViewController
|
|||
|
|
|
|||
|
|
#pragma mark - Life cycle
|
|||
|
|
- (instancetype)initWithRoomInfo:(id)roomInfo Role:(RCMicRoleType)role {
|
|||
|
|
self = [super init];
|
|||
|
|
if (self) {
|
|||
|
|
_joinRoomSuccess = NO;
|
|||
|
|
_kvSyncSuccess = NO;
|
|||
|
|
//进入房间,先请求计算器打开状态,再初始化进房间
|
|||
|
|
// [self checkCalculatorStatusWithModelInfo:roomInfo Role:role];
|
|||
|
|
[self initViewModelWithRoomInfo:roomInfo role:role];
|
|||
|
|
}
|
|||
|
|
return self;
|
|||
|
|
}
|
|||
|
|
//查看计算器状态
|
|||
|
|
//- (void)checkCalculatorStatusWithModelInfo:(id)roomInfo Role:(RCMicRoleType)role {
|
|||
|
|
// [RCMicHTTP postWithURLString:@"/api/api/calculator" parameters:@{} response:^(RCMicHTTPResult *result) {
|
|||
|
|
// [SVProgressHUD dismiss];
|
|||
|
|
// if (result.success) {
|
|||
|
|
// if (result.errorCode == 200 && [result.content isKindOfClass:NSDictionary.class]) {
|
|||
|
|
// NSString *is_calculator = [result.content safeStringForKey:@"is_calculator"];
|
|||
|
|
// GVUSER.is_calculator = is_calculator;
|
|||
|
|
// }else{
|
|||
|
|
// GVUSER.is_calculator = @"0";
|
|||
|
|
// }
|
|||
|
|
// [self initViewModelWithRoomInfo:roomInfo role:role];
|
|||
|
|
// [self addSubviews];
|
|||
|
|
// [self addConstraints];
|
|||
|
|
// [self joinMicRoom];
|
|||
|
|
// }else {
|
|||
|
|
// GVUSER.is_calculator = @"0";
|
|||
|
|
// [self initViewModelWithRoomInfo:roomInfo role:role];
|
|||
|
|
// [self addSubviews];
|
|||
|
|
// [self addConstraints];
|
|||
|
|
// [self joinMicRoom];
|
|||
|
|
// }
|
|||
|
|
// }];
|
|||
|
|
//}
|
|||
|
|
- (void)viewDidLoad {
|
|||
|
|
[super viewDidLoad];
|
|||
|
|
[UIApplication sharedApplication].idleTimerDisabled = YES;
|
|||
|
|
|
|||
|
|
[self addSubviews];
|
|||
|
|
[self addConstraints];
|
|||
|
|
[self joinMicRoom];
|
|||
|
|
//被顶号,如果再房间,需要退出房间
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kickedOffLineAction) name:TXIMDinghaoNoti object:nil];
|
|||
|
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(bjkeyboardDidHide) name:UIKeyboardWillHideNotification object:nil];
|
|||
|
|
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(onUpdateMsgDot) name:TXIMUnreadMessageNoti object:nil];
|
|||
|
|
|
|||
|
|
//312 巡乐会开始
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(BlindStartAction:) name:@"BlindxunlehuiStart" object:nil];
|
|||
|
|
//313 巡乐会开到锁定礼物更新时间
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(BlindUpdateTime:) name:@"BlindxunlehuiGetLockGift" object:nil];
|
|||
|
|
//316 巡乐会结束
|
|||
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(BlindEndAction) name:@"BlindxunlehuiEnd" object:nil];
|
|||
|
|
|
|||
|
|
[self onCreateXinrenViews];
|
|||
|
|
[self onJuageJiaoyouRoom];
|
|||
|
|
[self onCreatePaimaiViews];
|
|||
|
|
[self onCreateKTVViews];
|
|||
|
|
[self onRequestCurrentLaba];
|
|||
|
|
[self onSudJuageGameRoom];
|
|||
|
|
[self onJuageXiangqinRoomView];
|
|||
|
|
[self onJuageXiangqinJiubaRoom];
|
|||
|
|
|
|||
|
|
//游戏房不能屏蔽侧滑返回,不然游戏玩不了
|
|||
|
|
if (self.viewModel.roomInfo.is_Game != 1) {
|
|||
|
|
id traget = self.navigationController.interactivePopGestureRecognizer.delegate;
|
|||
|
|
UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];
|
|||
|
|
[self.view addGestureRecognizer:pan];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
- (void)kickedOffLineAction {
|
|||
|
|
// [self doThingsBeforeQuitRoom];
|
|||
|
|
self.isTotalQuitRoom = YES;
|
|||
|
|
[self backAction];
|
|||
|
|
}
|
|||
|
|
- (void)viewWillAppear:(BOOL)animated {
|
|||
|
|
[super viewWillAppear:animated];
|
|||
|
|
|
|||
|
|
_isTotalQuitRoom = NO;
|
|||
|
|
|
|||
|
|
[self onUpdateMsgDot];
|
|||
|
|
|
|||
|
|
//让挂件mp4动一下
|
|||
|
|
[self.pendantGiftV onPlayGiftVap];
|
|||
|
|
IQKeyboardManager *manager = IQKeyboardManager.sharedManager;
|
|||
|
|
manager.enable = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
-(void)onUpdateMsgDot {
|
|||
|
|
[self.customToolBar updateUnreadDot];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewDidAppear:(BOOL)animated {
|
|||
|
|
[super viewDidAppear:animated];
|
|||
|
|
|
|||
|
|
if (@available(iOS 13.0, *)) {
|
|||
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
|||
|
|
}else {
|
|||
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//交友厅,延迟几秒才让点麦位
|
|||
|
|
if (self.viewModel.roomInfo.is_dating == 1) {
|
|||
|
|
self.participantsArea.userInteractionEnabled = NO;
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
self.participantsArea.userInteractionEnabled = YES;
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewWillDisappear:(BOOL)animated {
|
|||
|
|
[super viewWillDisappear:animated];
|
|||
|
|
|
|||
|
|
if (@available(iOS 13.0, *)) {
|
|||
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDarkContent;
|
|||
|
|
}else {
|
|||
|
|
[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)viewDidDisappear:(BOOL)animated {
|
|||
|
|
[super viewDidDisappear:animated];
|
|||
|
|
|
|||
|
|
BOOL havePop = YES;
|
|||
|
|
for (UIViewController *vc in self.navigationController.viewControllers) {
|
|||
|
|
if ([vc isKindOfClass:RCMicRoomViewController.class]) {
|
|||
|
|
havePop = NO;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
if (havePop) {
|
|||
|
|
if(_isTotalQuitRoom) {
|
|||
|
|
[self doThingsBeforeQuitRoom];
|
|||
|
|
[BJFloatRoomManager.sharedBJFloatRoomManager closeFloatWindow];
|
|||
|
|
}else {
|
|||
|
|
//显示悬浮框
|
|||
|
|
[BJFloatRoomManager.sharedBJFloatRoomManager showFloatWindowWithModel:_viewModel WithRoomCtrl:self];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)doThingsBeforeQuitRoom {
|
|||
|
|
//离开页面停止房间里的混音
|
|||
|
|
// [[RCMicRTCService sharedService] stopMixingMusic];
|
|||
|
|
[BJSvgaManager.sharedBJSvgaManager stopAllSvga];
|
|||
|
|
[WebSocketManager.shared webSocketClose];
|
|||
|
|
[[BJAgoraRtmManager shared] logoutAndLeaveChannel];
|
|||
|
|
[BJFlyWordManager.sharedBJFlyWordManager stopAllFlyWord];
|
|||
|
|
//退出相关房间
|
|||
|
|
[_viewModel quitMicRoom:^{
|
|||
|
|
RCMicLog(@"quit mic room success!");
|
|||
|
|
} error:^{
|
|||
|
|
RCMicLog(@"quit mic room error!");
|
|||
|
|
//这里根据应用实际情况确定是否需要重试
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|||
|
|
// NSLog(@"开始了");
|
|||
|
|
UITouch *touch = [touches anyObject];
|
|||
|
|
CGPoint pointone = [touch locationInView:self.view];//获得初始的接触点
|
|||
|
|
//以字符的形式输出触摸点
|
|||
|
|
|
|||
|
|
_startX = pointone.x;
|
|||
|
|
NSLog(@"触摸点的坐标:%f",_startX);
|
|||
|
|
}
|
|||
|
|
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|||
|
|
UITouch *touch = [touches anyObject];
|
|||
|
|
//imgViewTop是滑动后最后接触的View
|
|||
|
|
CGPoint pointtwo = [touch locationInView:self.view]; //获得滑动后最后接触屏幕的点
|
|||
|
|
NSLog(@"移动点的坐标:%f,%f",pointtwo.x,_startX);
|
|||
|
|
int position = (pointtwo.x-_startX);
|
|||
|
|
NSLog(@"position is %d",position);
|
|||
|
|
if(fabs(pointtwo.x-_startX)>100)
|
|||
|
|
{ //判断两点间的距离
|
|||
|
|
NSLog(@"移动了");
|
|||
|
|
_bMove = YES;
|
|||
|
|
//左滑超过100,跳转房间排行榜
|
|||
|
|
// [UIViewController goRankPageWithRid:self.viewModel.roomInfo.roomId];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
|
|||
|
|
UITouch *touch = [touches anyObject];
|
|||
|
|
CGPoint pointtwo = [touch locationInView:self.view]; //获得滑动后最后接触屏幕的点
|
|||
|
|
if((fabs(pointtwo.x-_startX)>100)&&(_bMove))
|
|||
|
|
{
|
|||
|
|
//判断点的位置关系 左滑动
|
|||
|
|
if(pointtwo.x-_startX>0)
|
|||
|
|
{ //左向右滑动业务处理
|
|||
|
|
NSLog(@"左向右移动");
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
//判断点的位置关系 右滑动
|
|||
|
|
else
|
|||
|
|
{ //右向左滑动业务处理
|
|||
|
|
NSLog(@"右移动");
|
|||
|
|
//左滑超过100,跳转房间排行榜
|
|||
|
|
[UIViewController goRankPageWithRid:self.viewModel.roomInfo.roomId];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
- (void)dealloc {
|
|||
|
|
[UIApplication sharedApplication].idleTimerDisabled = NO;
|
|||
|
|
//释放资源
|
|||
|
|
[_viewModel descory];
|
|||
|
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
|||
|
|
NSLog(@"销毁%@", NSStringFromClass(self.class));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - Private method
|
|||
|
|
- (void)initViewModelWithRoomInfo:(RCMicRoomInfo *)roomInfo role:(RCMicRoleType)role {
|
|||
|
|
//自己转一下房间类型字段,cate_id 26 新人 27K歌 28拍卖 29交友 19酒吧 相亲36-37
|
|||
|
|
if ([roomInfo.cate_id integerValue] == 26) {
|
|||
|
|
roomInfo.is_xinren = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 27) {
|
|||
|
|
roomInfo.is_song = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 28) {
|
|||
|
|
roomInfo.is_paimai = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 29) {
|
|||
|
|
roomInfo.is_dating = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 35) {
|
|||
|
|
roomInfo.is_Game = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 36 || [roomInfo.cate_id integerValue] == 37) {
|
|||
|
|
roomInfo.is_xiangqin = 1;
|
|||
|
|
}else if ([roomInfo.cate_id integerValue] == 19) {
|
|||
|
|
roomInfo.is_blind_date = 1;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
_yb_rid = roomInfo.roomId;
|
|||
|
|
_viewModel = [[RCMicRoomViewModel alloc] initWithRoomInfo:roomInfo role:role];
|
|||
|
|
//聊天室 KV 信息同步完成
|
|||
|
|
[_viewModel setKvSyncCompleted:^{
|
|||
|
|
weakSelf.kvSyncSuccess = YES;
|
|||
|
|
[weakSelf checkRoomStatus];
|
|||
|
|
}];
|
|||
|
|
//消息区域更新
|
|||
|
|
[_viewModel setMessageChanged:^(RCMicMessageChangedType type, NSArray * _Nonnull indexs) {
|
|||
|
|
[weakSelf.chatView updateTableViewWithType:type indexs:indexs];
|
|||
|
|
}];
|
|||
|
|
//麦位区域更新
|
|||
|
|
[_viewModel setParticipantChanged:^(NSArray<NSString *> * _Nonnull keys) {
|
|||
|
|
[weakSelf.participantsArea updateCollectionViewWithKeys:keys];
|
|||
|
|
}];
|
|||
|
|
//光圈
|
|||
|
|
[_viewModel setGuangquanChanged:^(NSArray<NSString *> * _Nonnull keys) {
|
|||
|
|
[weakSelf.participantsArea updateGuangquanWithKeys:keys];
|
|||
|
|
}];
|
|||
|
|
//当前用户上下麦
|
|||
|
|
[_viewModel setDidHoldOrGiveUpMic:^(RCMicRoleType role) {
|
|||
|
|
//这里实际角色可能是主持人,但是主持人和参会者底部 toolbar 展示的内容一致,所以除了观众都可以认为是参会者
|
|||
|
|
// RCMicRoleType role = isHold ? RCMicRoleType_Participant : RCMicRoleType_Audience;
|
|||
|
|
BOOL haveAuth = weakSelf.viewModel.isRoomOwner || weakSelf.viewModel.isRoomAdministrator;
|
|||
|
|
[weakSelf.customToolBar updateWithRoleType:role auth:haveAuth];
|
|||
|
|
//每次角色转换后需要重新设置扬声器状态(因为 RTC 上下麦过程中相关状态被重置了)
|
|||
|
|
RCMicSpeakerState speakerState = weakSelf.viewModel.useSpeaker ? RCMicSpeakerStateOpen : RCMicSpeakerStateClose;
|
|||
|
|
[weakSelf setSpeakerState:speakerState];
|
|||
|
|
if (role==RCMicRoleType_Host || role==RCMicRoleType_Participant) {
|
|||
|
|
//每次角色上麦后需要重新设置麦克风状态(因为有可能在 RTC 上麦流程走完之前就设置过麦克风状态了,而 RTC 上麦流程中会重置麦克风状态),下麦不需要处理
|
|||
|
|
// RCMicMicrophoneState micState = weakSelf.viewModel.useMicrophone ? RCMicMicrophoneStateNormal : RCMicMicrophoneStateSilent;
|
|||
|
|
//这里改成了上麦后默认关闭麦克风
|
|||
|
|
RCMicMicrophoneState micState = RCMicMicrophoneStateSilent;
|
|||
|
|
[weakSelf setMicrophoneState:micState];
|
|||
|
|
//上麦后是否自动弹出选择拍卖信息
|
|||
|
|
if (weakSelf.viewModel.roomInfo.is_paimai == 1) {
|
|||
|
|
[weakSelf onPMAutoChooseAlert];
|
|||
|
|
}
|
|||
|
|
} else {
|
|||
|
|
//每次角色下麦后需要将当前伴音状态重置
|
|||
|
|
weakSelf.currentBgSoundIndexPath = [NSIndexPath indexPathForRow:0 inSection:0];
|
|||
|
|
// [[RCMicRTCService sharedService] stopMixingMusic];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
//直播间延迟更新
|
|||
|
|
[_viewModel setDelayInfoChanged:^(NSInteger delay) {
|
|||
|
|
[weakSelf.customNavigationView updateDelay:delay];
|
|||
|
|
}];
|
|||
|
|
//debug 模块统计信息更新
|
|||
|
|
[_viewModel setDebugInfoChanged:^(NSArray * _Nonnull array) {
|
|||
|
|
weakSelf.blinkExcelView.array = array;
|
|||
|
|
}];
|
|||
|
|
//直播间在线人数更新
|
|||
|
|
[_viewModel setOnlineCountChanged:^(NSInteger onlineCount) {
|
|||
|
|
[weakSelf.customNavigationView updateOnlineCount:onlineCount];
|
|||
|
|
}];
|
|||
|
|
//有人排麦状态更新
|
|||
|
|
[_viewModel setWaitingStateChanged:^(BOOL waiting) {
|
|||
|
|
[weakSelf.customNavigationView showTipLabel:waiting];
|
|||
|
|
}];
|
|||
|
|
//收到礼物消息
|
|||
|
|
[_viewModel setReceivedSvgaGift:^(NSString * _Nonnull svgaUrl, NSDictionary * _Nonnull cpDict) {
|
|||
|
|
//判断是否开启礼物效果再显示
|
|||
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|||
|
|
if (!GVUSER.closeGiftEffect) {
|
|||
|
|
[BJSvgaManager.sharedBJSvgaManager showSvgaUrl:svgaUrl onView:weakSelf.view cpDict:cpDict];
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}];
|
|||
|
|
//收到普通礼物消息
|
|||
|
|
[_viewModel setReceivedNormGift:^(NSString * _Nonnull uid, NSString * _Nonnull imgUrl) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf showNorGiftPathAnimate:imgUrl uid:uid];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
//麦克风状态改变
|
|||
|
|
[_viewModel setMicroPhoneStateChanged:^(BOOL enable) {
|
|||
|
|
RCMicMicrophoneState state = enable ? RCMicMicrophoneStateNormal : RCMicMicrophoneStateSilent;
|
|||
|
|
[weakSelf setMicrophoneState:state];
|
|||
|
|
}];
|
|||
|
|
//收到主持人的响应
|
|||
|
|
[_viewModel setTakeOverHostResponse:^(NSString * _Nonnull name, NSString * _Nonnull userId, BOOL result) {
|
|||
|
|
[weakSelf stopActiveWheelWithResponse:result isTimeout:NO];
|
|||
|
|
}];
|
|||
|
|
//收到被转让者的响应
|
|||
|
|
[_viewModel setHostTransferResponse:^(NSString * _Nonnull name, NSString * _Nonnull userId, BOOL result) {
|
|||
|
|
[weakSelf stopActiveWheelWithResponse:result isTimeout:NO];
|
|||
|
|
}];
|
|||
|
|
//麦位转换过程中相关错误回调
|
|||
|
|
[_viewModel setShowTipWithErrorInfo:^(NSString * _Nonnull description) {
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:description];
|
|||
|
|
}];
|
|||
|
|
//收到被踢消息
|
|||
|
|
[_viewModel setBj_kickRoomBlock:^{
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf backAction];
|
|||
|
|
[BJFloatRoomManager.sharedBJFloatRoomManager closeFloatWindow];
|
|||
|
|
weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"您已被踢出房间"];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
//设置管理员
|
|||
|
|
[_viewModel setBj_adminChangeBlock:^{
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
BOOL haveAuth = weakSelf.viewModel.isRoomOwner || weakSelf.viewModel.isRoomAdministrator;
|
|||
|
|
weakSelf.meiliImgView.hidden = !haveAuth;
|
|||
|
|
[weakSelf.customToolBar updateWithRoleType:weakSelf.viewModel.role auth:haveAuth];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
//修改房间名字
|
|||
|
|
_viewModel.bj_roomNameChangeBLock = ^(NSString * _Nonnull room_name) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf.customNavigationView updateRoomName:room_name];
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
//修改房间背景图
|
|||
|
|
_viewModel.bj_roomBGChangeBlock = ^(NSString * _Nonnull room_bg) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf.backgroundView sd_setImageWithURL:[NSURL URLWithString:room_bg]];
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
//表情
|
|||
|
|
[_viewModel setBj_emojiBlock:^(NSDictionary * _Nonnull eInfo) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf.participantsArea bj_showEmojiWith:eInfo];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
//锁房,所有人都退房
|
|||
|
|
[_viewModel setBj_lockRoomBlock:^{
|
|||
|
|
weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
[weakSelf backAction];
|
|||
|
|
}];
|
|||
|
|
//收到邀请上麦
|
|||
|
|
[_viewModel setXr_receiveInviteBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
YYRoomInviteAlert *view = LoadNib(@"YYRoomInviteAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
view.rid = [dict safeStringForKey:@"rid"];
|
|||
|
|
view.micro_id = [dict safeStringForKey:@"micro_id"];
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
}];
|
|||
|
|
//新人厅,更新当前状态
|
|||
|
|
[_viewModel setXr_updateStatusBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.participantsArea onUpdateXinrenUIWith:dict];
|
|||
|
|
//room_new_auction_status 当前厅状态 1进行竞拍中 2尚未有竞拍
|
|||
|
|
NSInteger status = [dict safeIntForKey:@"room_new_auction_status"];
|
|||
|
|
if (status == 2) {
|
|||
|
|
weakSelf.xrTop3View.hidden = YES;
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
[_viewModel setXr_updateRankBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
NSArray *arr = [YYXinrenTop3Model mj_objectArrayWithKeyValuesArray:dict[@"list"]];
|
|||
|
|
weakSelf.xrTop3View.dataArray = arr;
|
|||
|
|
}];
|
|||
|
|
[_viewModel setXr_qianyueResultBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf onXRQianyueResult:dict];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
// //获取当前房间的PK信息
|
|||
|
|
// [self onFetchPKDataWithAlert:NO];
|
|||
|
|
// //PK的socket
|
|||
|
|
// [_viewModel setBj_PKSocketBlock:^(NSDictionary * _Nonnull dataDict) {
|
|||
|
|
// [weakSelf onReceivePKSocket:dataDict];
|
|||
|
|
// }];
|
|||
|
|
|
|||
|
|
_viewModel.ktv_UpdateYidianBlock = ^(NSArray * _Nonnull arr, BOOL showTiaoyin) {
|
|||
|
|
[weakSelf.songListV onUpdateYiDian:arr];
|
|||
|
|
};
|
|||
|
|
[_viewModel setKtv_applyUpMicBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.jyApplyUpV onReceiveSocketWith:dict];
|
|||
|
|
NSInteger count = [dict safeIntForKey:@"priority_count"]+[dict safeIntForKey:@"common_count"];
|
|||
|
|
if (count > 0) {
|
|||
|
|
weakSelf.applyUpNumLab.hidden = NO;
|
|||
|
|
NSString *numStr = [NSString stringWithFormat:@"%ld", count];
|
|||
|
|
weakSelf.applyUpNumLab.text = numStr;
|
|||
|
|
}else {
|
|||
|
|
weakSelf.applyUpNumLab.hidden = YES;
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
[_viewModel setKtv_UpdatePlayBtnStatusBlock:^(BOOL isPlay) {
|
|||
|
|
weakSelf.songSettingV.playBtn.selected = isPlay;
|
|||
|
|
}];
|
|||
|
|
[_viewModel setKtv_updateStatusBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf onUpdateKTVStatusWith:dict];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setKtv_zhizuorenTipsBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
YYKTVTipsAlert *view = LoadNib(@"YYKTVTipsAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
view.rid = [dict safeStringForKey:@"rid"];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setKtv_loadLyricBlock:^(NSString * _Nonnull lyricUrl, BOOL isQingchang) {
|
|||
|
|
[weakSelf.lrcView setLrcUrlWithUrl:lyricUrl];
|
|||
|
|
}];
|
|||
|
|
//交友厅的
|
|||
|
|
[_viewModel setJiao_updateStageBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.participantsArea onUpdateJiaoyouUIWith:dict];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setJiao_chooseRelationBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
weakSelf.jyRelationV.dataDict = dict;
|
|||
|
|
[MainWindow() addSubview:weakSelf.jyRelationV];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setSimi_enterOrLeaveBlock:^(BOOL enter) {
|
|||
|
|
[weakSelf.customToolBar onEnterOrLeaveSimiRoom:enter];
|
|||
|
|
if (enter) {
|
|||
|
|
weakSelf.simiRoomV.prid = weakSelf.viewModel.roomInfo.simiRid;
|
|||
|
|
[weakSelf.view insertSubview:weakSelf.simiRoomV belowSubview:weakSelf.chatView];
|
|||
|
|
|
|||
|
|
[MainWindow() addSubview:weakSelf.jySimiVapView];
|
|||
|
|
if (weakSelf.viewModel.roomInfo.is_xiangqin == 1){
|
|||
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"酒吧房私密小屋特效" ofType:@"mp4"];
|
|||
|
|
[weakSelf.jySimiVapView playHWDMP4:path repeatCount:0 delegate:weakSelf];
|
|||
|
|
}else{
|
|||
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"jy_牵手" ofType:@"mp4"];
|
|||
|
|
[weakSelf.jySimiVapView playHWDMP4:path repeatCount:0 delegate:weakSelf];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}else {
|
|||
|
|
[weakSelf.simiRoomV removeFromSuperview];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
|
|||
|
|
[_viewModel setSimi_updateTimeBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.simiRoomV onUpdateSurplusTime:[dict safeIntForKey:@"surplus_time"]];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setSimi_updateZhenxinBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.simiRoomV onUpdateZhenxinContent:[dict safeStringForKey:@"content"]];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setSimi_updateGuangquanBlock:^(NSString * _Nonnull uid) {
|
|||
|
|
[weakSelf.simiRoomV onUpdateGuangquanWith:uid];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setJiao_pendantGiftBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
weakSelf.pendantGiftV.dataDict = dict;
|
|||
|
|
[weakSelf.view addSubview:weakSelf.pendantGiftV];
|
|||
|
|
}];
|
|||
|
|
//拍卖厅,更新当前状态
|
|||
|
|
[_viewModel setPm_updateStatusBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.participantsArea onUpdatePaimaiUIWith:dict];
|
|||
|
|
}];
|
|||
|
|
[_viewModel setPm_paimaiResultBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf onPMPaimaiResult:dict];
|
|||
|
|
}];
|
|||
|
|
//礼物托盘
|
|||
|
|
[_viewModel setReceivedGiftTuopan:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf onShowGiftTuopanWith:dict];
|
|||
|
|
[weakSelf onShowLuckyVapWith:dict];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
//封禁房间
|
|||
|
|
[_viewModel setBj_receiveCloseRoomBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
[weakSelf backAction];
|
|||
|
|
[BJFloatRoomManager.sharedBJFloatRoomManager closeFloatWindow];
|
|||
|
|
|
|||
|
|
NSInteger type = [dict safeIntForKey:@"type"];
|
|||
|
|
NSString *rid = [dict safeStringForKey:@"rid"];
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
if (type == 1) {
|
|||
|
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"房间类型已更改,是否重新进入该房间" preferredStyle:UIAlertControllerStyleAlert];
|
|||
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
}]];
|
|||
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[UIViewController goMicRoomWithRid:rid withPwd:@""];
|
|||
|
|
}]];
|
|||
|
|
[[UIViewController currentViewController] presentViewController:alert animated:YES completion:nil];
|
|||
|
|
}else if (type == 2) {
|
|||
|
|
UIAlertController *alert = [UIAlertController alertControllerWithTitle:nil message:@"该房间已关闭" preferredStyle:UIAlertControllerStyleAlert];
|
|||
|
|
[alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
}]];
|
|||
|
|
[[UIViewController currentViewController] presentViewController:alert animated:YES completion:nil];
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[_viewModel setBj_receiveLaba:^(NSDictionary * _Nonnull dataDict) {
|
|||
|
|
[weakSelf onReceiveLaba:dataDict];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[_viewModel setBj_PlayInRoomCPTXBlock:^(NSDictionary * _Nonnull cp_info) {
|
|||
|
|
weakSelf.cpvapView.hidden = NO;
|
|||
|
|
[weakSelf.cpvapView playVapWithDict:cp_info];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[_viewModel setBj_MotianlunDayBlcok:^(NSDictionary * _Nonnull info) {
|
|||
|
|
NSLog(@"%@",info);
|
|||
|
|
BJFlyWordModel *model = [BJFlyWordModel new];
|
|||
|
|
NSString *name = [info safeStringForKey:@"u_nick_name"];
|
|||
|
|
NSString *u_receive_name = [info safeStringForKey:@"u_receive_name"];
|
|||
|
|
NSString *gift_name = [info safeStringForKey:@"gift_name"];
|
|||
|
|
model.flyType = 3;
|
|||
|
|
model.totalStr = [NSString stringWithFormat:@"恭喜%@与%@在恋爱摩天轮中获得%@!",name,u_receive_name,gift_name];
|
|||
|
|
model.roomId = weakSelf.viewModel.roomInfo.roomId;
|
|||
|
|
//暂时隐藏
|
|||
|
|
[BJFlyWordManager.sharedBJFlyWordManager showFlyWordWithModel:model];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
_viewModel.bj_sudGameStart = ^{
|
|||
|
|
[weakSelf onSudLoginGame];
|
|||
|
|
};
|
|||
|
|
_viewModel.bj_sudGameEnd = ^{
|
|||
|
|
[weakSelf onSudLogoutGame];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//相亲厅
|
|||
|
|
[_viewModel setXiangqin_updateStageBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[weakSelf.participantsArea onUpdateXiangqinUIWith:dict];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[_viewModel setXq_receiveGoSimiRoomBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
[MainWindow() addSubview:weakSelf.jySimiVapView];
|
|||
|
|
if (weakSelf.viewModel.roomInfo.is_xiangqin == 1){
|
|||
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"酒吧房私密小屋特效" ofType:@"mp4"];
|
|||
|
|
[weakSelf.jySimiVapView playHWDMP4:path repeatCount:0 delegate:weakSelf];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
//酒吧相亲房
|
|||
|
|
[_viewModel setXq_receiveInviteBlock:^(NSDictionary * _Nonnull dict) {
|
|||
|
|
// YYXQInviteAlert *view = LoadNib(@"YYXQInviteAlert");
|
|||
|
|
// view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
// [MainWindow() addSubview:view];
|
|||
|
|
// view.dataDict = dict;
|
|||
|
|
//狸猫收到推送自己上麦,不再弹是否同意的窗口
|
|||
|
|
NSDictionary *params = @{@"rid":[dict safeStringForKey:@"rid"], @"id":[dict safeStringForKey:@"id"], @"micro_id":[dict safeStringForKey:@"micro_id"], @"type":@"1"};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/room/operate_room_owner_up_micro" Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[_viewModel setXiangqin_agreeJoinHechang:^{
|
|||
|
|
[weakSelf xiangqinHechangLrcView];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
//表情
|
|||
|
|
[_viewModel setBj_JiubaGifBlock:^(NSDictionary * _Nonnull eInfo) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf.participantsArea bj_showJiubaGifWith:eInfo];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
//表情
|
|||
|
|
[_viewModel setBj_JiubaGifArrListBlock:^(NSDictionary * _Nonnull eInfo) {
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[weakSelf.participantsArea bj_showJiubaGifArrListWith:eInfo];
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
//厅主注销账号,需要退出房间
|
|||
|
|
_viewModel.bj_RoomOwnerCloseAccountBlock = ^{
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
[weakSelf backAction];
|
|||
|
|
})
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)addSubviews {
|
|||
|
|
[self.view addGestureRecognizer:self.tapGesture];
|
|||
|
|
[self.view addSubview:self.backgroundView];
|
|||
|
|
[self.view addSubview:self.participantsArea];
|
|||
|
|
[self.view addSubview:self.customNavigationView];
|
|||
|
|
[self.view addSubview:self.meiliImgView];
|
|||
|
|
[self.view addSubview:self.room_noticeBtn];
|
|||
|
|
[self.view addSubview:self.descBtn];
|
|||
|
|
[self onAddTop3AndUsersView];
|
|||
|
|
[self.view addSubview:self.chatView];
|
|||
|
|
[self.view addSubview:self.publicSelectView];
|
|||
|
|
[self.view addSubview:self.customToolBar];
|
|||
|
|
[self.view addSubview:self.inputBar];
|
|||
|
|
[self.view addSubview:self.blinkExcelView];
|
|||
|
|
[self.view addSubview:self.rankBtn];
|
|||
|
|
[self.view addSubview:self.blindShowV];
|
|||
|
|
self.rankBtn.hidden = YES;
|
|||
|
|
[self onCreateBangdanBgView];
|
|||
|
|
[self.view addSubview:self.applyUpBtn];
|
|||
|
|
[self.view addSubview:self.applyUpNumLab];
|
|||
|
|
|
|||
|
|
[self onRequestPendantGiftData];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)addConstraints {
|
|||
|
|
[self.backgroundView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.edges.equalTo(self.view);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.customNavigationView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.equalTo(self.view);
|
|||
|
|
make.right.equalTo(self.view);
|
|||
|
|
CGFloat margin = [RCMicUtil statusBarHeight];
|
|||
|
|
make.top.equalTo(self.view).with.offset(margin);
|
|||
|
|
make.height.mas_equalTo(44);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.participantsArea mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.centerX.equalTo(self.view);
|
|||
|
|
make.width.equalTo(self.view);
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom);
|
|||
|
|
// make.height.mas_equalTo(320);
|
|||
|
|
make.bottom.equalTo(self.customToolBar.mas_top).offset(0);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.publicSelectView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.equalTo(self.view);
|
|||
|
|
make.width.mas_equalTo(260);
|
|||
|
|
make.height.mas_equalTo(30);
|
|||
|
|
make.bottom.equalTo(self.chatView.mas_top);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.chatView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(305);
|
|||
|
|
make.left.equalTo(self.view);
|
|||
|
|
make.right.equalTo(self.view).offset(-90);
|
|||
|
|
make.bottom.equalTo(self.customToolBar.mas_top);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.customToolBar mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.equalTo(self.view);
|
|||
|
|
make.width.equalTo(self.view);
|
|||
|
|
make.height.mas_equalTo(ToolBarHeight);
|
|||
|
|
make.bottom.equalTo(self.view).with.offset(-yb_HomeIndicator_H);
|
|||
|
|
}];
|
|||
|
|
[self.applyUpBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.right.mas_equalTo(-15);
|
|||
|
|
make.bottom.equalTo(self.customToolBar.mas_top).offset(-5);
|
|||
|
|
make.width.mas_equalTo(90);
|
|||
|
|
make.height.mas_equalTo(28);
|
|||
|
|
}];
|
|||
|
|
[self.applyUpNumLab mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.right.equalTo(self.applyUpBtn).offset(3);
|
|||
|
|
make.top.equalTo(self.applyUpBtn).offset(-5);
|
|||
|
|
make.width.mas_equalTo(16);
|
|||
|
|
make.height.mas_equalTo(16);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
LMCPInRoomVapView *vapView = LoadNib(@"LMCPInRoomVapView");
|
|||
|
|
vapView.frame = CGRectMake(0, 0, APPW, APPH);
|
|||
|
|
[MainWindow() addSubview:vapView];
|
|||
|
|
self.cpvapView = vapView;
|
|||
|
|
self.cpvapView.hidden = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)joinMicRoom {
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
//加入房间
|
|||
|
|
[self.viewModel joinMicRoom:^{
|
|||
|
|
//警告消息
|
|||
|
|
[weakSelf.viewModel bj_showRoomWelcome];
|
|||
|
|
[weakSelf.viewModel bj_showOwnerNotice];
|
|||
|
|
|
|||
|
|
// [weakSelf.viewModel bj_sendMyCommingWithVipInfo:@{@"contribution_level_image":@""}];
|
|||
|
|
//加入房间后需要等待 viewmodel 中的 KvSyncCompleted 回调才能开始从 聊天室 KV 中拉取麦位信息
|
|||
|
|
weakSelf.joinRoomSuccess = YES;
|
|||
|
|
[weakSelf checkRoomStatus];
|
|||
|
|
//获取VIP信息
|
|||
|
|
[weakSelf checkVipPetStatus];
|
|||
|
|
} imError:^{
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
//#warning 暂时关掉
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:RCMicLocalizedNamed(@"room_joinIM_failed")];
|
|||
|
|
// weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
// [weakSelf.navigationController popViewControllerAnimated:YES];//暂时关掉
|
|||
|
|
})
|
|||
|
|
} rtcError:^{
|
|||
|
|
RCMicMainThread(^{
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:RCMicLocalizedNamed(@"room_joinRTC_failed")];
|
|||
|
|
// weakSelf.isTotalQuitRoom = YES;
|
|||
|
|
// [weakSelf.navigationController popViewControllerAnimated:YES];//暂时关掉
|
|||
|
|
})
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)checkRoomStatus {
|
|||
|
|
//加入房间完成并且 KV 同步完成后才能开始加载初始房间数据
|
|||
|
|
//融云换声网注释
|
|||
|
|
// if (self.joinRoomSuccess && self.kvSyncSuccess) {
|
|||
|
|
// [self loadDataAndPrepareAudioStream];
|
|||
|
|
// }
|
|||
|
|
if (self.joinRoomSuccess) {
|
|||
|
|
[self loadDataAndPrepareAudioStream];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)checkVipPetStatus {
|
|||
|
|
NSDictionary *dict = @{@"rid":C_string(_viewModel.roomInfo.roomId)};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
|
|||
|
|
[SVProgressHUD showWithStatus:nil];
|
|||
|
|
__weak __typeof(self)weakSelf = self;
|
|||
|
|
[RCMicHTTP postWithURLString:@"/api/room/get_room_user_vip" parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
[SVProgressHUD dismiss];
|
|||
|
|
if (result.success) {
|
|||
|
|
if (result.errorCode == 200 && [result.content isKindOfClass:NSDictionary.class]) {
|
|||
|
|
NSString *petUrl = [result.content safeStringForKey:@"zq_play_image"];
|
|||
|
|
if (petUrl.length > 0) {
|
|||
|
|
[weakSelf.viewModel bj_sendPetMsg:petUrl cpInfo:result.content[@"cp_info"]];
|
|||
|
|
}
|
|||
|
|
NSDictionary *cp_info = result.content[@"cp_info"];
|
|||
|
|
NSString *texiao_img = [cp_info safeStringForKey:@"texiao_img"];
|
|||
|
|
if (texiao_img.length > 0){
|
|||
|
|
[weakSelf.viewModel bj_sendCPTXWithCPInfo:cp_info];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RCMicUserVip *userInfo = [RCMicUserVip mj_objectWithKeyValues:result.content];
|
|||
|
|
weakSelf.viewModel.vipInfo = userInfo;
|
|||
|
|
weakSelf.viewModel.roomInfo.is_room_hiding = userInfo.is_room_hiding;
|
|||
|
|
[weakSelf.viewModel bj_sendMyCommingWithVipInfo:result.content];
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)loadDataAndPrepareAudioStream {
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
//发布或订阅音频流,失败后根据应用实际需求处理 UI 即可
|
|||
|
|
// [self.viewModel publishOrSubscribeAudioStream:^{
|
|||
|
|
// } error:^{
|
|||
|
|
// RCMicMainThread(^{
|
|||
|
|
// [RCMicActiveWheel showPromptHUDAddedTo:weakSelf.view text:RCMicLocalizedNamed(@"room_publishOrSubscribeStream_failed")];
|
|||
|
|
// })
|
|||
|
|
// }];
|
|||
|
|
|
|||
|
|
//加载麦位数据
|
|||
|
|
[self.viewModel bj_loadAllParticipantViewModel:^(BOOL isOk) {
|
|||
|
|
// no callback
|
|||
|
|
}];
|
|||
|
|
self.viewModel.participantFirstLoad = ^(BOOL isOK) {
|
|||
|
|
if (isOK) {
|
|||
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|||
|
|
[weakSelf.participantsArea reloadData];
|
|||
|
|
});
|
|||
|
|
}else {
|
|||
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:RCMicLocalizedNamed(@"room_getParticipantInfo_failed")];
|
|||
|
|
//进入房间获取麦位初始信息失败后退出聊天室
|
|||
|
|
[weakSelf backAction];
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)shouldShowInputBar:(BOOL)show {
|
|||
|
|
//如果没有被禁言按正常流程操作
|
|||
|
|
if (show) {
|
|||
|
|
self.inputBar.hidden = NO;
|
|||
|
|
[self.inputBar becomeFirstResponderIfNeed];
|
|||
|
|
} else {
|
|||
|
|
self.inputBar.hidden = YES;
|
|||
|
|
[self.inputBar resignFirstResponderIfNeed];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)setSpeakerState:(RCMicSpeakerState)state {
|
|||
|
|
BOOL enable = state == RCMicSpeakerStateOpen ? YES : NO;
|
|||
|
|
[self.viewModel setUseSpeaker:enable];
|
|||
|
|
self.customToolBar.speakerState = state;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)setMicrophoneState:(RCMicMicrophoneState)state {
|
|||
|
|
BOOL enable = state == RCMicMicrophoneStateNormal ? YES : NO;
|
|||
|
|
[self.viewModel setUseMicrophone:enable];
|
|||
|
|
self.customToolBar.microPhoneState = state;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)activeWheelTimerAction {
|
|||
|
|
[self stopActiveWheelWithResponse:NO isTimeout:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* 结束主持人转让及接管相关转轮
|
|||
|
|
*
|
|||
|
|
* @param accept 对方是否同意
|
|||
|
|
* @param timeout 是否是定时器触发的结束
|
|||
|
|
*/
|
|||
|
|
- (void)stopActiveWheelWithResponse:(BOOL)accept isTimeout:(BOOL)timeout {
|
|||
|
|
[RCMicActiveWheel hideHUDForView:RCMicKeyWindow animated:YES];
|
|||
|
|
if (timeout) {
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:RCMicLocalizedNamed(@"room_tip_noresponse")];
|
|||
|
|
} else {
|
|||
|
|
if (!accept) {
|
|||
|
|
[RCMicActiveWheel showPromptHUDAddedTo:RCMicKeyWindow text:RCMicLocalizedNamed(@"room_tip_refuse")];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
[self.wheelDismissTimer invalidate];
|
|||
|
|
self.wheelDismissTimer = nil;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)configAndPresentController:(UIViewController *)controller {
|
|||
|
|
controller.modalPresentationStyle = UIModalPresentationOverCurrentContext;
|
|||
|
|
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
|
|||
|
|
[self.navigationController presentViewController:controller animated:YES completion:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - Actions
|
|||
|
|
- (void)tapAction {
|
|||
|
|
[self shouldShowInputBar:NO];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)backAction {
|
|||
|
|
[self.navigationController popToRootViewControllerAnimated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)speakerAction {
|
|||
|
|
RCMicSpeakerState state = self.customToolBar.speakerState == RCMicSpeakerStateOpen ? RCMicSpeakerStateClose : RCMicSpeakerStateOpen;
|
|||
|
|
[self setSpeakerState:state];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)microphoneAction {
|
|||
|
|
if (_viewModel.currentParticipantInfo.state == RCMicParticipantStateSilent) {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"你已被禁止说话"];
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
RCMicMicrophoneState microphoneState = self.customToolBar.microPhoneState == RCMicMicrophoneStateNormal ? RCMicMicrophoneStateSilent : RCMicMicrophoneStateNormal;
|
|||
|
|
[self setMicrophoneState:microphoneState];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 右上角
|
|||
|
|
- (void)navTouchMenu {
|
|||
|
|
UIAlertController *sheetAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|||
|
|
UIAlertAction *action1 = [UIAlertAction actionWithTitle:@"最小化房间" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[self backAction];
|
|||
|
|
}];
|
|||
|
|
[action1 setValue:HEXCOLOR(0x333333) forKey:@"_titleTextColor"];
|
|||
|
|
[sheetAlert addAction:action1];
|
|||
|
|
|
|||
|
|
UIAlertAction *action2 = [UIAlertAction actionWithTitle:@"退出房间" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
self.isTotalQuitRoom = YES;
|
|||
|
|
[self backAction];
|
|||
|
|
}];
|
|||
|
|
[action2 setValue:HEXCOLOR(0x333333) forKey:@"_titleTextColor"];
|
|||
|
|
[sheetAlert addAction:action2];
|
|||
|
|
|
|||
|
|
UIAlertAction *action3 = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil];
|
|||
|
|
[action3 setValue:HEXCOLOR(0x333333) forKey:@"_titleTextColor"];
|
|||
|
|
[sheetAlert addAction:action3];
|
|||
|
|
[self presentViewController:sheetAlert animated:YES completion:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
///
|
|||
|
|
- (void)navTouchMsgBtn {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"点击消息"];
|
|||
|
|
TXMessageVC *vc = [TXMessageVC new];
|
|||
|
|
vc.isFromRoom = YES;
|
|||
|
|
vc.naviVC = self.navigationController;
|
|||
|
|
[vc popupWithPopType:HWPopTypeNone dismissType:HWDismissTypeNone position:HWPopPositionBottom];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)navWanfaBtn {
|
|||
|
|
RoomNoticeAlertView *view = [[NSBundle mainBundle] loadNibNamed:@"RoomNoticeAlertView" owner:self options:nil].firstObject;
|
|||
|
|
view.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
|
|||
|
|
view.contentStr = self.viewModel.roomInfo.room_intro;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)showBaoMaiAlert {
|
|||
|
|
[self.userAlert showOnView:self.view haveSearchTf:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - 收键盘通知
|
|||
|
|
- (void)bjkeyboardDidHide {
|
|||
|
|
self.inputBar.hidden = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - UIGestureRecognizerDelegate
|
|||
|
|
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
|
|||
|
|
if ([touch.view isKindOfClass:[UICollectionView class]] || [touch.view isKindOfClass:[UICollectionReusableView class]] || [touch.view isKindOfClass:[UITableView class]]) {
|
|||
|
|
if ([touch.view isKindOfClass:NSClassFromString(@"RoomBtoMoreCell")]) {
|
|||
|
|
return NO;
|
|||
|
|
}
|
|||
|
|
return YES;
|
|||
|
|
}
|
|||
|
|
return NO;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - RCMicRoomNavigationViewDelegate
|
|||
|
|
- (void)roomNavigationView:(RCMicRoomNavigationView *)navigationView didSelectItemWithTag:(RCMicRoomNavigationViewTag)tag {
|
|||
|
|
|
|||
|
|
switch (tag) {
|
|||
|
|
case RCMicRoomNavigationViewBackButton:
|
|||
|
|
[self backAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomNavigationViewMenuButton:
|
|||
|
|
[self navTouchMenu];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomNavigationViewMsgButton:
|
|||
|
|
[self navTouchMsgBtn];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomNavigationViewPeopleButton:
|
|||
|
|
[self.userAlert showOnView:self.view haveSearchTf:NO];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomNavigationViewWanfaButton:
|
|||
|
|
[self navWanfaBtn];
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - RCMicParticipantsAreaDelegate
|
|||
|
|
- (void)participantsArea:(RCMicParticipantsArea *)participantsArea didSelectItemWithViewModel:(RCMicParticipantViewModel *)participantViewModel {
|
|||
|
|
__block NSString *areaId = @(participantViewModel.participantInfo.position-1).stringValue;
|
|||
|
|
__weak __typeof(self)weakSelf = self;
|
|||
|
|
NSString *seatUseId = participantViewModel.participantInfo.userId;
|
|||
|
|
|
|||
|
|
// //相亲房神秘人,不能查看信息
|
|||
|
|
// if (participantViewModel.participantInfo.xq_uid_sm==2 && ![self.viewModel isRoomHost]){
|
|||
|
|
// [HelpPageDefine showMessage:@"用户未亮相"];
|
|||
|
|
// return;
|
|||
|
|
// }
|
|||
|
|
|
|||
|
|
//当前点击麦位有人
|
|||
|
|
if (seatUseId.length > 0) {
|
|||
|
|
//点击自己
|
|||
|
|
if ([seatUseId isEqualToString:BJUserManager.userInfo.uid]) {
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:seatUseId style:BJOperationAlertTypeClickSelf area:participantViewModel];
|
|||
|
|
}
|
|||
|
|
//点击别人
|
|||
|
|
else {
|
|||
|
|
if (_viewModel.isRoomAdministrator || _viewModel.isRoomOwner) {
|
|||
|
|
if ([_viewModel uidIsRoomOwner:seatUseId]) {
|
|||
|
|
NSLog(@"房管点击房主,只显示魅力值");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:seatUseId style:BJOperationAlertTypeOnlyMeiLiBtn area:participantViewModel];
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"点击普通用户,显示5个按钮");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:seatUseId style:BJOperationAlertTypeFiveBtn area:participantViewModel];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"普通用户点击别人,中间按钮都不显示");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:seatUseId style:BJOperationAlertTypeZeroBtn area:participantViewModel];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//当前麦位没有人
|
|||
|
|
else {
|
|||
|
|
if (participantViewModel.participantInfo.state == RCMicParticipantStateClosed) {
|
|||
|
|
//已锁定
|
|||
|
|
if (_viewModel.isRoomAdministrator || _viewModel.isRoomOwner){
|
|||
|
|
NSLog(@"显示放开麦位");
|
|||
|
|
UIAlertController *sheetAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"放开麦位" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[weakSelf.viewModel bj_lockPositionWithmicid:areaId lock:NO];
|
|||
|
|
}]];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
|
|||
|
|
[self presentViewController:sheetAlert animated:YES completion:nil];
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"普通用户点击有锁麦位,无响应");
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
//normal
|
|||
|
|
if (participantViewModel.participantInfo.position == 0) {
|
|||
|
|
//点击主持位
|
|||
|
|
if (_viewModel.isRoomAdministrator) {
|
|||
|
|
NSLog(@"房管点击空主持,上麦");
|
|||
|
|
[self.viewModel bj_upHostMic];
|
|||
|
|
}else if (_viewModel.isRoomOwner){
|
|||
|
|
NSLog(@"房主点击空主持,上麦");
|
|||
|
|
[self.viewModel bj_upHostMic];
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"普通用户空主持,无响应");
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
//点击空普通麦位
|
|||
|
|
if (_viewModel.isRoomAdministrator || _viewModel.isRoomOwner) {
|
|||
|
|
NSLog(@"底部弹框显示 上麦,抱人上麦,锁麦一共3项");
|
|||
|
|
UIAlertController *sheetAlert = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"上麦" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[weakSelf.viewModel bj_upParticipantWithMicId:areaId finish:^(BOOL isOk) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}]];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"抱人上麦" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
GVUSER.position = NSStringFormat(@"%ld",participantViewModel.participantInfo.position-1
|
|||
|
|
);
|
|||
|
|
[weakSelf showBaoMaiAlert];
|
|||
|
|
}]];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"锁麦" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[weakSelf.viewModel bj_lockPositionWithmicid:areaId lock:YES];
|
|||
|
|
}]];
|
|||
|
|
[sheetAlert addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
|
|||
|
|
[self presentViewController:sheetAlert animated:YES completion:nil];
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"普通用户直接上麦");
|
|||
|
|
[_viewModel bj_upParticipantWithMicId:areaId finish:^(BOOL isOk) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark -------------------点击麦位头像-------------------------
|
|||
|
|
|
|||
|
|
|
|||
|
|
//type,1,无权限view;2,有权限view
|
|||
|
|
- (void)showWithType:(NSInteger )type {
|
|||
|
|
if (type==1) {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - bj BJMicRoomOperationAlertDelegate
|
|||
|
|
|
|||
|
|
- (void)operationAlertTrigerAction:(BJOperation)operation targetUserModel:(BJOperationAlertUserModel *)tUserModel area:(nonnull RCMicParticipantViewModel *)aModel {
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
NSString *areaId = @(aModel.participantInfo.position-1).stringValue;
|
|||
|
|
|
|||
|
|
if (operation == BJOperationDonate) {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"转赠"];
|
|||
|
|
//转赠
|
|||
|
|
MH_ZhuanZengView *view = [[NSBundle mainBundle] loadNibNamed:@"MH_ZhuanZengView" owner:nil options:nil].lastObject;
|
|||
|
|
view.frame = CGRectMake(0, 0, ScreenWidth, ScreenHeight);
|
|||
|
|
view.userInfoModel = tUserModel;
|
|||
|
|
[[UIViewController currentViewController].view addSubview:view];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//底部按钮
|
|||
|
|
else if (operation == BJOperationChat) {
|
|||
|
|
TXSingleChatVC *vc = [[TXSingleChatVC alloc] init];
|
|||
|
|
vc.userId = tUserModel.uid;
|
|||
|
|
vc.titleStr = tUserModel.nick_name;
|
|||
|
|
[self.navigationController pushViewController:vc animated:YES];
|
|||
|
|
}else if (operation == BJOperationGift){
|
|||
|
|
//送礼物
|
|||
|
|
[self.roomGiftView bj_showMicDownGiftWithDict:tUserModel.mj_JSONObject];
|
|||
|
|
|
|||
|
|
// if ([self.viewModel getUserMicmsgWithUid:tUserModel.uid]) {
|
|||
|
|
// [self.roomGiftView bj_showGiftAlertWithTargetUser:tUserModel.uid helpUid:nil];
|
|||
|
|
// }else {
|
|||
|
|
// [self.roomGiftView bj_showMicDownGiftWithDict:tUserModel.mj_JSONObject];
|
|||
|
|
// }
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationHome){
|
|||
|
|
//个人主页
|
|||
|
|
//显示悬浮框
|
|||
|
|
// [BJFloatRoomManager.sharedBJFloatRoomManager showFloatWindowWithModel:_viewModel WithRoomCtrl:self];
|
|||
|
|
[UIViewController goUserMainpageWith:tUserModel.uid withRid:C_string(_viewModel.roomInfo.roomId)];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//中间按钮
|
|||
|
|
else if (operation == BJOperationForceUp) {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"抱上麦"];
|
|||
|
|
[_viewModel bj_forceMicUpWithParticipant:tUserModel.uid micid:areaId];
|
|||
|
|
[_viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_BeUpMic];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationForceDown){
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"强制下麦"];
|
|||
|
|
[_viewModel bj_forceMicDownWithParticipant:tUserModel.uid];
|
|||
|
|
[_viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_BeDownMic];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationVoiceOpen){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"开麦"];
|
|||
|
|
[_viewModel bj_unlockVoiceWithParticipant:tUserModel.uid];
|
|||
|
|
[_viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_EnableVoice];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationVoiceClose){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"禁麦"];
|
|||
|
|
[_viewModel bj_lockVoiceWithParticipant:tUserModel.uid];
|
|||
|
|
[_viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_DisableVoice];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationMsgOpen){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"解除禁言"];
|
|||
|
|
[_viewModel bj_unlockMsgWithParticipant:tUserModel.uid];
|
|||
|
|
[_viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_EnableMsg];
|
|||
|
|
// [self getAdd_adminWithParameters:tUserModel.uid rid:_viewModel.roomInfo.roomId];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationMsgClose){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"禁言"];
|
|||
|
|
[_viewModel bj_lockMsgWithParticipant:tUserModel.uid success:^(BOOL isOK) {
|
|||
|
|
[weakSelf.viewModel bj_sendOperationRoomMessageTo:tUserModel.uid type:BJIMMsgType_DisableMsg];
|
|||
|
|
}];
|
|||
|
|
// [self getRemove_adminWithParameters:tUserModel.uid rid:_viewModel.roomInfo.roomId];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationKickRoom){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"踢出房间"];
|
|||
|
|
[_viewModel bj_kickUserOutRoom:tUserModel.uid success:^{
|
|||
|
|
//成功之后发一条私聊消息
|
|||
|
|
[weakSelf.viewModel bj_sendKickRoomMessageTo:tUserModel.uid];
|
|||
|
|
} error:^(RCMicHTTPCode errCode) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
else if (operation == BJOperationLockSeat){
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"封闭座位"];
|
|||
|
|
[_viewModel bj_lockSeatWithUid:tUserModel.uid position:aModel.participantInfo.position success:^(BOOL isOK) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}else if (operation == BJOperationClearCharm) {
|
|||
|
|
[_viewModel bj_clearCharmValueWithUid:tUserModel.uid success:^(BOOL isOK) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}else if (operation == BJOperationSiliaoTa) {//私聊ta
|
|||
|
|
self.siliaoId = tUserModel.uid;
|
|||
|
|
[self.inputBar setText:[NSString stringWithFormat:@"私聊%@ ", tUserModel.nick_name]];
|
|||
|
|
[self bot_showMsgInput];
|
|||
|
|
}else if (operation == BJOperationAtTa) {//@ta
|
|||
|
|
[self.inputBar setText:[NSString stringWithFormat:@"@%@ ", tUserModel.nick_name]];
|
|||
|
|
[self bot_showMsgInput];
|
|||
|
|
}else if (operation == BJOperationSelfDownMic) {//主动下麦
|
|||
|
|
[self bot_micChangeAction];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)getAdd_adminWithParameters:(NSString *)uid rid:(NSString *)rid{
|
|||
|
|
NSDictionary *dict = @{@"uid":uid, @"rid":rid};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
// [SVProgressHUD showWithStatus:nil];
|
|||
|
|
[RCMicHTTP postWithURLString:@"/api/room/set_room_admin" parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
[SVProgressHUD dismiss];
|
|||
|
|
if (result.success) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
[weakSelf.viewModel bj_sendAdminChangeMessageTo:uid isAdmin:YES];
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)getRemove_adminWithParameters:(NSString *)uid rid:(NSString *)rid{
|
|||
|
|
NSDictionary *dict = @{@"uid":uid, @"rid":rid};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
// [SVProgressHUD showWithStatus:nil];
|
|||
|
|
[RCMicHTTP postWithURLString:@"/api/room/unset_room_admin" parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
[SVProgressHUD dismiss];
|
|||
|
|
if (result.success) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
[weakSelf.viewModel bj_sendAdminChangeMessageTo:uid isAdmin:NO];
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/*
|
|||
|
|
RCMicRoomToolBarMessageButton = 100,// 发消息按钮
|
|||
|
|
RCMicRoomToolBarMicChangeButton,// 上下麦
|
|||
|
|
RCMicRoomToolBarSpeakerButton,// 扬声器按钮
|
|||
|
|
RCMicRoomToolBarMicrophoneButton,// 麦克风按钮
|
|||
|
|
RCMicRoomToolBarEmojiButton,// 表情按钮
|
|||
|
|
RCMicRoomToolBarMoreButton,//伴音按钮
|
|||
|
|
RCMicRoomToolBarGameButton,//游戏按钮
|
|||
|
|
RCMicRoomToolBarGiftButton,//送礼按钮
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#pragma mark - RCMicRoomToolBarDelegate
|
|||
|
|
- (void)roomToolBar:(RCMicRoomToolBar *)toolBar didSelectItemWithTag:(RCMicRoomToolBarViewTag)tag {
|
|||
|
|
switch (tag) {
|
|||
|
|
case RCMicRoomToolBarMessageButton:
|
|||
|
|
[self bot_showMsgInput];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarMicChangeButton:
|
|||
|
|
[self bot_micChangeAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarSpeakerButton:
|
|||
|
|
[self speakerAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarMicrophoneButton:
|
|||
|
|
[self microphoneAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarEmojiButton:
|
|||
|
|
[self bot_emojiAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarMoreButton:
|
|||
|
|
// [self bot_emojiAction];
|
|||
|
|
[self bot_moreAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarGameButton:
|
|||
|
|
[self bot_gameAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarGiftButton:
|
|||
|
|
[self bot_giftAction];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarSiliaoButton:
|
|||
|
|
[self bot_siliao];
|
|||
|
|
break;
|
|||
|
|
case RCMicRoomToolBarCPRankButton:
|
|||
|
|
{
|
|||
|
|
// YYRoomCPRankView *view = LoadNib(@"YYRoomCPRankView");
|
|||
|
|
// view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
// [KEYWINDOW addSubview:view];
|
|||
|
|
LMLoveSkyWheelViewController *swvc = [[LMLoveSkyWheelViewController alloc] init];
|
|||
|
|
[swvc pushSelf];
|
|||
|
|
}
|
|||
|
|
break;
|
|||
|
|
default:
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_showMsgInput {
|
|||
|
|
[self shouldShowInputBar:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_micChangeAction {
|
|||
|
|
if (_viewModel.currentParticipantInfo) {
|
|||
|
|
if (_viewModel.currentParticipantInfo.position == 0) {
|
|||
|
|
[_viewModel bj_downHostMic];
|
|||
|
|
}else {
|
|||
|
|
[_viewModel bj_downParticipant:^(BOOL isOK) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
//for循环找到合适的位置
|
|||
|
|
RCMicParticipantViewModel *emptyModel;
|
|||
|
|
NSArray *noOrderKeys = _viewModel.participantDataSource.allKeys;
|
|||
|
|
NSArray *allKeys = [noOrderKeys sortedArrayUsingSelector:@selector(compare:)];
|
|||
|
|
for (int i=1; i<allKeys.count; i++) {
|
|||
|
|
RCMicParticipantViewModel *model = _viewModel.participantDataSource[allKeys[i]];
|
|||
|
|
if (model.participantInfo.userId.length==0 && model.participantInfo.state!=RCMicParticipantStateClosed) {
|
|||
|
|
emptyModel = model;
|
|||
|
|
break;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if (emptyModel) {
|
|||
|
|
NSString *areaId = @(emptyModel.participantInfo.position-1).stringValue;
|
|||
|
|
[_viewModel bj_upParticipantWithMicId:areaId finish:^(BOOL isOk) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"当前没有空闲的麦位"];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_moreAction {
|
|||
|
|
__weak __typeof(self)weakSelf = self;
|
|||
|
|
//更多功能
|
|||
|
|
RoomBotMoreView *botMoreView = [[RoomBotMoreView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight) viewModel:_viewModel];
|
|||
|
|
[MainWindow() addSubview:botMoreView];
|
|||
|
|
//打开关闭声音
|
|||
|
|
botMoreView.voiceClickBLock = ^(BOOL isClose) {
|
|||
|
|
weakSelf.viewModel.useSpeaker = isClose;
|
|||
|
|
[weakSelf speakerAction];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//打开关闭特效
|
|||
|
|
botMoreView.texiaoClickBlock = ^(BOOL isClose) {
|
|||
|
|
GVUSER.closeGiftEffect = !GVUSER.closeGiftEffect;
|
|||
|
|
if (GVUSER.closeGiftEffect) {
|
|||
|
|
[[BJSvgaManager sharedBJSvgaManager] stopAllSvga];
|
|||
|
|
[weakSelf.luckyVapView removeFromSuperview];
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//房间设置
|
|||
|
|
botMoreView.roomSetClickBlock = ^{
|
|||
|
|
[UIViewController goRoomSetWithId:weakSelf.viewModel.roomInfo.roomId roomInfo:^{
|
|||
|
|
//完成之后,请求room_info重新获取接口
|
|||
|
|
[weakSelf get_roomInfoRequest];
|
|||
|
|
}];
|
|||
|
|
// YYRoomSettingVC *vc = [[YYRoomSettingVC alloc] init];
|
|||
|
|
// vc.rid = weakSelf.viewModel.roomInfo.roomId;
|
|||
|
|
// vc.onUpdateInfoBlock = ^(NSDictionary * _Nonnull dict) {
|
|||
|
|
// //给聊天室所有人发消息,更新修改信息
|
|||
|
|
// [weakSelf.viewModel bj_sendRoomSettingMsg:dict];
|
|||
|
|
// //自己需要手动修改,发的消息自己收不到
|
|||
|
|
// [weakSelf handleRoomChangeWithRoomDic:dict];
|
|||
|
|
// };
|
|||
|
|
// [weakSelf.navigationController pushViewController:vc animated:YES];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//设置管理员
|
|||
|
|
botMoreView.setAdminClickBlock = ^{
|
|||
|
|
[weakSelf bot_setAdmin];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//消息
|
|||
|
|
botMoreView.msgClickBlock = ^{
|
|||
|
|
TXMessageVC *vc = [TXMessageVC new];
|
|||
|
|
vc.isFromRoom = YES;
|
|||
|
|
vc.naviVC = weakSelf.navigationController;
|
|||
|
|
[vc popupWithPopType:HWPopTypeNone dismissType:HWDismissTypeNone position:HWPopPositionBottom];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//清公屏
|
|||
|
|
botMoreView.clearClickBlock = ^{
|
|||
|
|
[weakSelf.viewModel bj_sendAdminClearMsg];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//设置管理员
|
|||
|
|
botMoreView.setChaoguanClickBlock = ^{
|
|||
|
|
[weakSelf bot_setChaoguan];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//PK
|
|||
|
|
botMoreView.createPKBlock = ^{
|
|||
|
|
AmPKVC *vc = [[AmPKVC alloc]init];
|
|||
|
|
vc.roomId = weakSelf.viewModel.roomInfo.roomId;
|
|||
|
|
[vc pushSelf];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//锁房解锁
|
|||
|
|
botMoreView.lockRoomBlock = ^(BOOL isLock) {
|
|||
|
|
[weakSelf lockRoomRequest:isLock];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
//音乐
|
|||
|
|
botMoreView.musicClickBlock = ^{
|
|||
|
|
[weakSelf.view addSubview:weakSelf.musicView];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
botMoreView.onPublishGBHeadBlock = ^{
|
|||
|
|
[weakSelf showRoomHeadlinePublishView];
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
botMoreView.blackListBlock = ^{
|
|||
|
|
LMRoomBlackListViewController *vc = [[LMRoomBlackListViewController alloc] init];
|
|||
|
|
vc.rid = weakSelf.viewModel.roomInfo.roomId;
|
|||
|
|
[weakSelf.navigationController pushViewController:vc animated:YES];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)lockRoomRequest:(BOOL)isLock {
|
|||
|
|
NSDictionary *dict = @{@"rid":C_string(_viewModel.roomInfo.roomId)};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
|
|||
|
|
NSString *urlStr = isLock ? @"api/room/lock_room" : @"api/room/unlock_room";
|
|||
|
|
|
|||
|
|
[SVProgressHUD showWithStatus:nil];
|
|||
|
|
[RCMicHTTP postWithURLString:urlStr parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
[SVProgressHUD dismiss];
|
|||
|
|
if (result.success) {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
self.viewModel.roomInfo.is_lock = isLock ? 2 : 1;
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark -------------------获取房间设置信息-------------------------
|
|||
|
|
- (void)get_roomInfoRequest {
|
|||
|
|
|
|||
|
|
NSDictionary *dict = @{@"rid":C_string(_viewModel.roomInfo.roomId)};
|
|||
|
|
NSMutableDictionary *paras = [NSMutableDictionary dictionary];
|
|||
|
|
[paras addEntriesFromDictionary:dict];
|
|||
|
|
|
|||
|
|
[SVProgressHUD showWithStatus:nil];
|
|||
|
|
__weak __typeof(self)weakSelf = self;
|
|||
|
|
[RCMicHTTP postWithURLString:@"/api/room/get_room_info" parameters:paras response:^(RCMicHTTPResult *result) {
|
|||
|
|
[SVProgressHUD dismiss];
|
|||
|
|
if (result.success) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
//给聊天室所有人发消息,更新修改信息
|
|||
|
|
[weakSelf.viewModel bj_sendRoomSettingMsg:result.content];
|
|||
|
|
|
|||
|
|
//自己需要手动修改,发的消息自己收不到
|
|||
|
|
[weakSelf handleRoomChangeWithRoomDic:result.content];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"网络错误"];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
- (void)handleRoomChangeWithRoomDic:(NSDictionary *)info {
|
|||
|
|
NSString *room_name = [info safeStringForKey:@"room_name"];
|
|||
|
|
NSString *room_intro = [info safeStringForKey:@"room_intro"];
|
|||
|
|
NSString *room_background_image = [info safeStringForKey:@"room_background_image"];
|
|||
|
|
if ([_viewModel.roomInfo.roomName isEqualToString:room_name]) {
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
_viewModel.roomInfo.roomName = room_name;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
if ([_viewModel.roomInfo.room_background_image isEqualToString:room_background_image]) {
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
_viewModel.roomInfo.room_background_image = room_background_image;
|
|||
|
|
[self.backgroundView sd_setImageWithURL:[NSURL URLWithString:room_background_image]];
|
|||
|
|
}
|
|||
|
|
if ([_viewModel.roomInfo.room_intro isEqualToString:room_intro]) {
|
|||
|
|
|
|||
|
|
}else{
|
|||
|
|
_viewModel.roomInfo.room_intro = room_intro;
|
|||
|
|
[_viewModel bj_showOwnerNotice];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
- (void)bot_gameAction {
|
|||
|
|
UIAlertController *sheet = [UIAlertController alertControllerWithTitle:nil message:nil preferredStyle:UIAlertControllerStyleActionSheet];
|
|||
|
|
|
|||
|
|
[sheet addAction:[UIAlertAction actionWithTitle:@"开宝箱" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[self bot_subBoxGame];
|
|||
|
|
}]];
|
|||
|
|
[sheet addAction:[UIAlertAction actionWithTitle:@"星球探险" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|||
|
|
[self bot_subExploreGame];
|
|||
|
|
}]];
|
|||
|
|
[sheet addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
|
|||
|
|
[self presentViewController:sheet animated:YES completion:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/// 礼物 按钮点击进来 是给全部用户送礼物
|
|||
|
|
- (void)bot_giftAction {
|
|||
|
|
|
|||
|
|
[self.roomGiftView bj_showGiftAlertWithTargetUser:nil helpUid:nil];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_emojiAction {
|
|||
|
|
if (!_emojiAlert) {
|
|||
|
|
_emojiAlert = [[BJRoomEmojiAlert alloc] initWithRoomModel:_viewModel];
|
|||
|
|
}
|
|||
|
|
[_emojiAlert showOnView:self.view];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_setAdmin {
|
|||
|
|
BJRoomSetAdminiCtrl *VC = [[BJRoomSetAdminiCtrl alloc] init];
|
|||
|
|
VC.rid = _viewModel.roomInfo.roomId;
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
VC.adminiStrClickBlock = ^(BJRoomBaomaiModel *adminiModel) {
|
|||
|
|
[weakSelf.viewModel bj_sendAdminChangeMessageTo:adminiModel.uid isAdmin:adminiModel.is_admin];
|
|||
|
|
};
|
|||
|
|
[self.navigationController pushViewController:VC animated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_subBoxGame {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_subExploreGame {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_setChaoguan {
|
|||
|
|
BJRoomSetChaoguanCtrl *VC = [[BJRoomSetChaoguanCtrl alloc] init];
|
|||
|
|
VC.rid = _viewModel.roomInfo.roomId;
|
|||
|
|
// __weak typeof(self) weakSelf = self;
|
|||
|
|
VC.adminiStrClickBlock = ^(BJRoomBaomaiModel *adminiModel) {
|
|||
|
|
// [weakSelf.viewModel bj_sendAdminChangeMessageTo:adminiModel.uid isAdmin:adminiModel.is_admin];
|
|||
|
|
};
|
|||
|
|
[self.navigationController pushViewController:VC animated:YES];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)bot_siliao {
|
|||
|
|
TXMessageVC *vc = [[TXMessageVC alloc] init];
|
|||
|
|
vc.isFromRoom = YES;
|
|||
|
|
vc.naviVC = self.navigationController;
|
|||
|
|
[vc popupWithPopType:HWPopTypeNone dismissType:HWDismissTypeNone position:HWPopPositionBottom];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - RCMicChatViewDelegate 聊天cell
|
|||
|
|
- (void)chatView:(RCMicChatView *)chatView didTapMessageCell:(RCMicMessageBaseCell *)cell withViewModel:(BJChatMsgModel *)messageViewModel {
|
|||
|
|
//如果主持人点击聊天室消息 可以对观众进行操作
|
|||
|
|
|
|||
|
|
NSInteger chatType = messageViewModel.messageType.integerValue;
|
|||
|
|
if (chatType == BJIMMsgType_RoomNotice) {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"点击公告"];
|
|||
|
|
}
|
|||
|
|
else if (chatType == BJIMMsgType_EnterRoom) {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"进入直播间"];
|
|||
|
|
}
|
|||
|
|
else if (chatType == BJIMMsgType_SendChat) {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:[NSString stringWithFormat:@"点击%@的发言", messageViewModel.nickName]];
|
|||
|
|
}
|
|||
|
|
else if (chatType == BJIMMsgType_SendGift) {
|
|||
|
|
// [SVProgressHUD showInfoWithStatus:@"点击礼物消息"];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
- (void)chatView:(RCMicChatView *)chateView didClickUserNameWithUserID:(NSString *)uid{
|
|||
|
|
RCMicParticipantViewModel *model = [_viewModel getUserMicmsgWithUid:uid];
|
|||
|
|
// __weak __typeof(self)weakSelf = self;
|
|||
|
|
if ([uid isEqualToString:BJUserManager.userInfo.uid]) {
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:uid style:BJOperationAlertTypeClickSelf area:model];
|
|||
|
|
}else{
|
|||
|
|
if (_viewModel.isRoomAdministrator || _viewModel.isRoomOwner) {
|
|||
|
|
if ([_viewModel uidIsRoomOwner:uid]) {
|
|||
|
|
NSLog(@"房管点击房主,只显示魅力值");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:uid style:BJOperationAlertTypeOnlyMeiLiBtn area:model];
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"点击普通用户,显示5个按钮");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:uid style:BJOperationAlertTypeFiveBtn area:model];
|
|||
|
|
}
|
|||
|
|
}else {
|
|||
|
|
NSLog(@"普通用户点击别人,中间按钮都不显示");
|
|||
|
|
[self.operationAlert loadUserDataAndShowWithUid:uid style:BJOperationAlertTypeZeroBtn area:model];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
#pragma mark - RCMicInputBarControlDelegate
|
|||
|
|
- (void)inputBar:(RCMicInputBar *)inputBar didTouchsendButton:(NSString *)text {
|
|||
|
|
NSDictionary *params = @{@"rid":self.viewModel.roomInfo.roomId};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/room/get_user_world_status" Loading:YES Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
BOOL isNormal = [responseDic[@"data"] safeIntForKey:@"lock_status"]==1; //1正常
|
|||
|
|
if (isNormal) {
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"api/user/check_user_is_real" Loading:YES Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
NSDictionary *data = [responseDic safeDictionaryForKey:@"data"];
|
|||
|
|
//1-已实名 2-未实名
|
|||
|
|
NSInteger is_real = [data safeIntForKey:@"is_real"];
|
|||
|
|
if (is_real == 1){
|
|||
|
|
[inputBar clearInputView];
|
|||
|
|
[self shouldShowInputBar:NO];
|
|||
|
|
|
|||
|
|
[self.viewModel bj_sendInputString:text siliao_id:self.siliaoId];
|
|||
|
|
self.siliaoId = @"";
|
|||
|
|
}else{
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"请实名认证"];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
}else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:@"你已被禁止公屏发言"];
|
|||
|
|
}
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - 礼物相关
|
|||
|
|
|
|||
|
|
- (BJRoomGiftAlert *)roomGiftView{
|
|||
|
|
if (!_roomGiftView) {
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
_roomGiftView = [[BJRoomGiftAlert alloc] initWithRoomModel:_viewModel];
|
|||
|
|
_roomGiftView.topUpButtonClickBlock = ^{
|
|||
|
|
[UIViewController goRechageCtrl];
|
|||
|
|
};
|
|||
|
|
_roomGiftView.judgeBoxBlock = ^{
|
|||
|
|
[weakSelf.chatView onRequestJudgeShowBox];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _roomGiftView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)showNorGiftPathAnimate:(NSString *)url uid:(NSString *)uid {
|
|||
|
|
// CGPoint startCenter = CGPointMake(APPW-30, APPH-yb_HomeIndicator_H-30);
|
|||
|
|
CGPoint startCenter = CGPointMake(30, yb_NavigationBar_H+30);
|
|||
|
|
CGPoint end = [self.participantsArea bj_pointWithUid:uid];
|
|||
|
|
CGPoint fixEndCenter = CGPointMake(_participantsArea.x+end.x, _participantsArea.y+end.y);
|
|||
|
|
if (end.x==0 && end.y==0) {
|
|||
|
|
//麦上没有人,取消路径动画
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
NSInteger startWidth = 60;
|
|||
|
|
CGRect startRect = CGRectMake(startCenter.x-startWidth/2, startCenter.y-startWidth/2, startWidth, startWidth);
|
|||
|
|
UIImageView *norImg = [ControlCreator createImageView:MainWindow() rect:startRect imageName:nil backguoundColor:nil];
|
|||
|
|
norImg.contentMode = UIViewContentModeScaleAspectFit;
|
|||
|
|
[norImg sd_setImageWithURL:URL(C_string(url))];
|
|||
|
|
|
|||
|
|
NSInteger endWidth = 40;
|
|||
|
|
CGRect endRect = CGRectMake(fixEndCenter.x-endWidth/2, fixEndCenter.y-endWidth/2, endWidth, endWidth);
|
|||
|
|
[UIView transitionWithView:norImg duration:0.6 options:UIViewAnimationOptionCurveEaseOut | UIViewAnimationOptionTransitionFlipFromRight animations:^{
|
|||
|
|
norImg.frame = endRect;
|
|||
|
|
} completion:^(BOOL finished) {
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
[norImg removeFromSuperview];
|
|||
|
|
});
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------- PK相关 ---------------------
|
|||
|
|
|
|||
|
|
-(UIButton *)stopPkBtn{
|
|||
|
|
if(!_stopPkBtn){
|
|||
|
|
_stopPkBtn = [ControlCreator createButton:nil rect:CGRectZero text:@"结束PK" font:YBFont(12) color:kWhiteColor backguoundColor:[mainDeepColor colorWithAlphaComponent:0.2] imageName:nil target:self action:nil];
|
|||
|
|
_stopPkBtn.hidden = YES;
|
|||
|
|
[self.view addSubview:_stopPkBtn];
|
|||
|
|
_stopPkBtn.layer.cornerRadius = 12.5;
|
|||
|
|
_stopPkBtn.layer.borderWidth = 0.5;
|
|||
|
|
_stopPkBtn.layer.borderColor = mainDeepColor.CGColor;
|
|||
|
|
[_stopPkBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
NSDictionary *params = @{@"rid":self.viewModel.roomInfo.roomId};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"api/room/close_room_pk_by_rid" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
[_stopPkBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+70);
|
|||
|
|
make.right.mas_equalTo(-15);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(58, 25));
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
return _stopPkBtn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (PklineView *)pkView {
|
|||
|
|
if (!_pkView) {
|
|||
|
|
_pkView = [[NSBundle mainBundle] loadNibNamed:@"PklineView" owner:self options:nil].firstObject;
|
|||
|
|
_pkView.hidden = YES;
|
|||
|
|
[self.view addSubview:_pkView];
|
|||
|
|
[_pkView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.bottom.equalTo(self.participantsArea.mas_bottom).offset(10);
|
|||
|
|
make.left.right.equalTo(self.view);
|
|||
|
|
make.height.mas_equalTo(65);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
return _pkView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onFetchPKDataWithAlert:(BOOL)isShowAlert {
|
|||
|
|
NSDictionary *params = @{@"rid":C_string(self.viewModel.roomInfo.roomId)};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"api/room/get_room_pk_info" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
SPPKInfoModel *model = [SPPKInfoModel mj_objectWithKeyValues:responseDic[@"data"]];
|
|||
|
|
if (model.is_close == 1) {//有PK
|
|||
|
|
self.pkView.model = model;
|
|||
|
|
self.pkView.hidden = NO;
|
|||
|
|
|
|||
|
|
if (self.viewModel.isRoomAdministrator || self.viewModel.isRoomOwner) {
|
|||
|
|
self.stopPkBtn.hidden = NO;
|
|||
|
|
}else{
|
|||
|
|
self.stopPkBtn.hidden = YES;
|
|||
|
|
}
|
|||
|
|
[self.participantsArea ishowImagetype:NO winteam:@""];
|
|||
|
|
}else {
|
|||
|
|
//没有PK
|
|||
|
|
self.stopPkBtn.hidden = YES;
|
|||
|
|
self.pkView.hidden = YES;
|
|||
|
|
}
|
|||
|
|
[self.participantsArea mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.height.mas_equalTo(model.is_close==1?370:320);
|
|||
|
|
}];
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onReceivePKSocket:(NSDictionary *)dataDict {
|
|||
|
|
SPPKInfoModel *model = [SPPKInfoModel mj_objectWithKeyValues:dataDict];
|
|||
|
|
self.pkView.model = model;
|
|||
|
|
self.pkView.hidden = NO;
|
|||
|
|
[self.participantsArea ishowImagetype:NO winteam:@""];
|
|||
|
|
if (_viewModel.isRoomAdministrator || _viewModel.isRoomOwner) {
|
|||
|
|
self.stopPkBtn.hidden = NO;
|
|||
|
|
}else{
|
|||
|
|
self.stopPkBtn.hidden = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ([dataDict safeIntForKey:@"is_close"] != 1) {//已结束
|
|||
|
|
self.stopPkBtn.hidden = YES;
|
|||
|
|
NSString *win = [NSString stringWithFormat:@"%@",dataDict[@"winner_group"]];
|
|||
|
|
[self.participantsArea ishowWinTeam:win];
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
self.pkView.hidden = YES;
|
|||
|
|
[self.participantsArea mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.height.mas_equalTo(320);
|
|||
|
|
}];
|
|||
|
|
});
|
|||
|
|
}else {
|
|||
|
|
[self.participantsArea mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.height.mas_equalTo(370);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - Getters & Setters
|
|||
|
|
- (UITapGestureRecognizer *)tapGesture {
|
|||
|
|
if (!_tapGesture) {
|
|||
|
|
_tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
|
|||
|
|
_tapGesture.delegate = self;
|
|||
|
|
}
|
|||
|
|
return _tapGesture;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIImageView *)backgroundView {
|
|||
|
|
if (!_backgroundView) {
|
|||
|
|
_backgroundView = [[UIImageView alloc] initWithFrame:CGRectZero];
|
|||
|
|
_backgroundView.contentMode = UIViewContentModeScaleAspectFill;
|
|||
|
|
_backgroundView.layer.masksToBounds = YES;
|
|||
|
|
UIImage *placeImg = [UIImage imageNamed:@"room_background"];
|
|||
|
|
[_backgroundView sd_setImageWithURL:URL(_viewModel.roomInfo.room_background_image) placeholderImage:placeImg];
|
|||
|
|
}
|
|||
|
|
return _backgroundView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RCMicRoomNavigationView *)customNavigationView {
|
|||
|
|
if (!_customNavigationView) {
|
|||
|
|
_customNavigationView = [[RCMicRoomNavigationView alloc] initWithFrame:CGRectZero viewModel:self.viewModel];
|
|||
|
|
_customNavigationView.delegate = self;
|
|||
|
|
}
|
|||
|
|
return _customNavigationView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RCMicRoomToolBar *)customToolBar {
|
|||
|
|
if (!_customToolBar) {
|
|||
|
|
_customToolBar = [[RCMicRoomToolBar alloc] initWithFrame:CGRectZero];
|
|||
|
|
_customToolBar.delegate = self;
|
|||
|
|
BOOL haveAuth = _viewModel.isRoomOwner || _viewModel.isRoomAdministrator;
|
|||
|
|
[_customToolBar updateWithRoleType:self.viewModel.role auth:haveAuth];
|
|||
|
|
}
|
|||
|
|
return _customToolBar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RCMicParticipantsArea *)participantsArea {
|
|||
|
|
if (!_participantsArea) {
|
|||
|
|
_participantsArea = [[RCMicParticipantsArea alloc] initWithFrame:CGRectZero viewModel:self.viewModel];
|
|||
|
|
_participantsArea.delegate = self;
|
|||
|
|
WEAK_SELF
|
|||
|
|
_participantsArea.jiao_micHelpBlock = ^(NSString * _Nonnull uid) {
|
|||
|
|
[weakSelf.roomGiftView bj_showGiftAlertWithTargetUser:uid helpUid:uid];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _participantsArea;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RCMicChatView *)chatView {
|
|||
|
|
if (!_chatView) {
|
|||
|
|
_chatView = [[RCMicChatView alloc] initWithFrame:CGRectZero viewModel:self.viewModel];
|
|||
|
|
_chatView.delegate = self;
|
|||
|
|
}
|
|||
|
|
return _chatView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RCMicInputBar *)inputBar {
|
|||
|
|
if (!_inputBar) {
|
|||
|
|
CGFloat height = [RCMicUtil bottomSafeAreaHeight] + InputBarHeight;
|
|||
|
|
CGFloat originY = RCMicScreenHeight - height;
|
|||
|
|
_inputBar = [[RCMicInputBar alloc] initWithFrame:CGRectMake(0, originY, RCMicScreenWidth, height)];
|
|||
|
|
_inputBar.delegate = self;
|
|||
|
|
_inputBar.hidden = YES;
|
|||
|
|
}
|
|||
|
|
return _inputBar;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RoomPublicSelectView *)publicSelectView {
|
|||
|
|
if (!_publicSelectView) {
|
|||
|
|
_publicSelectView = [[RoomPublicSelectView alloc] initWithFrame:CGRectZero viewModel:self.viewModel];
|
|||
|
|
_publicSelectView.backgroundColor = kClearColor;
|
|||
|
|
WEAK_SELF
|
|||
|
|
_publicSelectView.onSelectBlock = ^{
|
|||
|
|
[weakSelf onChangeSelectChat];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _publicSelectView;
|
|||
|
|
}
|
|||
|
|
- (RCMicBlinkExcelView *)blinkExcelView {
|
|||
|
|
if (!_blinkExcelView) {
|
|||
|
|
_blinkExcelView = [[RCMicBlinkExcelView alloc] initWithFrame:CGRectMake(0, 0, RCMicScreenWidth, RCMicScreenHeight) viewModel:self.viewModel];
|
|||
|
|
_blinkExcelView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.35];
|
|||
|
|
_blinkExcelView.hidden = YES;
|
|||
|
|
}
|
|||
|
|
return _blinkExcelView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (BJMicRoomOperationAlert *)operationAlert {
|
|||
|
|
if (_viewModel == nil) {
|
|||
|
|
return nil;
|
|||
|
|
}
|
|||
|
|
if (_operationAlert == nil) {
|
|||
|
|
_operationAlert = [BJMicRoomOperationAlert initOperationAlertWithRoomModel:_viewModel];
|
|||
|
|
_operationAlert.delegate = self;
|
|||
|
|
}
|
|||
|
|
return _operationAlert;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIButton *)rankBtn {
|
|||
|
|
if (!_rankBtn) {
|
|||
|
|
_rankBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|||
|
|
[_rankBtn setImage:ImageNamed(@"room_rank") forState:UIControlStateNormal];
|
|||
|
|
_rankBtn.frame = CGRectMake(15, ZJTopNavH+15, 60, 18);
|
|||
|
|
WEAK_SELF
|
|||
|
|
[_rankBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
// SPBangDanContainerVC *vc = [[SPBangDanContainerVC alloc] init];
|
|||
|
|
// vc.rid = weakSelf.viewModel.roomInfo.roomId;
|
|||
|
|
// [vc pushSelf];
|
|||
|
|
[weakSelf.view addSubview:weakSelf.bangdanBgView];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
}
|
|||
|
|
return _rankBtn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIButton *)room_noticeBtn {
|
|||
|
|
if (!_room_noticeBtn) {
|
|||
|
|
_room_noticeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|||
|
|
[_room_noticeBtn setImage:ImageNamed(@"room_nav_wanfa") forState:UIControlStateNormal];
|
|||
|
|
if ([_viewModel.roomInfo.enter_user_type integerValue]<3) {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(APPW-65, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}else{
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(APPW-65, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}
|
|||
|
|
WEAK_SELF
|
|||
|
|
[_room_noticeBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
[weakSelf navWanfaBtn];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
}
|
|||
|
|
return _room_noticeBtn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIButton *)descBtn {
|
|||
|
|
if (!_descBtn) {
|
|||
|
|
_descBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|||
|
|
_descBtn.titleLabel.font = YBBoldFont(10);
|
|||
|
|
[_descBtn setTitle:@"玩法说明" forState:UIControlStateNormal];
|
|||
|
|
[_descBtn setTitleColor:kWhiteColor forState:UIControlStateNormal];
|
|||
|
|
[_descBtn setImage:ImageNamed(@"xq_room_wanfa") forState:UIControlStateNormal];
|
|||
|
|
_descBtn.frame = CGRectMake(self.room_noticeBtn.right+15, yb_NavigationBar_H+15, 70, 25);
|
|||
|
|
[_descBtn ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeLeftImageLeft padding:5];
|
|||
|
|
_descBtn.hidden = YES;
|
|||
|
|
[_descBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
// 相亲厅玩法说明
|
|||
|
|
[UIViewController goWebWithUrl:[VERSION_HTTPS_SERVER stringByAppendingString:@"index.php/index/index/page_show?id=22"]];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
}
|
|||
|
|
return _descBtn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIImageView *)meiliImgView {
|
|||
|
|
if (!_meiliImgView) {
|
|||
|
|
_meiliImgView = [[UIImageView alloc] initWithFrame:CGRectMake(16, yb_NavigationBar_H+15, 50, 25)];
|
|||
|
|
_meiliImgView.image = ImageNamed(@"room_clean_meili");
|
|||
|
|
_meiliImgView.contentMode = UIViewContentModeCenter;
|
|||
|
|
if ([_viewModel.roomInfo.enter_user_type integerValue]<3) {
|
|||
|
|
_meiliImgView.hidden = NO;
|
|||
|
|
}else{
|
|||
|
|
_meiliImgView.hidden = YES;
|
|||
|
|
}
|
|||
|
|
__weak typeof(self) weakSelf = self;
|
|||
|
|
_meiliImgView.touchViewBlock = ^{
|
|||
|
|
SPAlertController *controller = [SPAlertController alertControllerWithTitle:@"是否清空魅力值?" message:@"" preferredStyle:SPAlertControllerStyleAlert];
|
|||
|
|
SPAlertAction *cancel = [SPAlertAction actionWithTitle:@"取消" style:SPAlertActionStyleCancel handler:^(SPAlertAction * _Nonnull action) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
SPAlertAction *queding = [SPAlertAction actionWithTitle:@"确定" style:SPAlertActionStyleCancel handler:^(SPAlertAction * _Nonnull action) {
|
|||
|
|
[weakSelf clearRoomMeiliRequest];
|
|||
|
|
}];
|
|||
|
|
[controller addAction:cancel];
|
|||
|
|
[controller addAction:queding];
|
|||
|
|
[weakSelf presentViewController:controller animated:YES completion:nil];
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _meiliImgView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (BlindXunlehuiShowView *)blindShowV {
|
|||
|
|
if (!_blindShowV) {
|
|||
|
|
_blindShowV = LoadNib(@"BlindXunlehuiShowView");
|
|||
|
|
_blindShowV.frame = CGRectMake(ScreenWidth-120, [RCMicUtil statusBarHeight]+480, 110, 110);
|
|||
|
|
_blindShowV.hidden = YES;
|
|||
|
|
if ([GVUSER.is_open_blindXlh isEqual:@"1"]) {
|
|||
|
|
_blindShowV.leftTimeL.text = [NSString stringWithFormat:@"剩余时间:%@", [NSString minuteAndSecStringWithTime:[_viewModel.roomInfo.blind_box_term_over_time intValue]]];
|
|||
|
|
self.leftSecond = [_viewModel.roomInfo.blind_box_term_over_time intValue];
|
|||
|
|
[self.timer startGCDTimer:1 delegate:self];
|
|||
|
|
_blindShowV.hidden = NO;
|
|||
|
|
}else {
|
|||
|
|
_blindShowV.leftTimeL.text = @"0:00";
|
|||
|
|
_blindShowV.hidden = YES;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
return _blindShowV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//巡乐会开始
|
|||
|
|
- (void)BlindStartAction:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
_blindShowV.leftTimeL.text = [NSString stringWithFormat:@"剩余时间:%@", [NSString minuteAndSecStringWithTime:[data safeIntForKey:@"over_time"]]];
|
|||
|
|
_blindShowV.hidden = NO;
|
|||
|
|
self.leftSecond = [data safeIntForKey:@"over_time"];
|
|||
|
|
[self.timer startGCDTimer:1 delegate:self];
|
|||
|
|
}
|
|||
|
|
//巡乐会开到锁定礼物更新时间
|
|||
|
|
-(void)BlindUpdateTime:(NSNotification *)notify {
|
|||
|
|
NSDictionary *data = notify.userInfo;
|
|||
|
|
_blindShowV.leftTimeL.text = [NSString stringWithFormat:@"剩余时间:%@", [NSString minuteAndSecStringWithTime:[data safeIntForKey:@"end_time"]]];
|
|||
|
|
self.leftSecond = [data safeIntForKey:@"end_time"];
|
|||
|
|
[self.timer startGCDTimer:1 delegate:self];
|
|||
|
|
}
|
|||
|
|
//巡乐会结束
|
|||
|
|
- (void)BlindEndAction {
|
|||
|
|
_blindShowV.leftTimeL.text = @"0:00";
|
|||
|
|
_blindShowV.hidden = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (ZWTimer *)timer {
|
|||
|
|
if (!_timer) {
|
|||
|
|
_timer = [[ZWTimer alloc] init];
|
|||
|
|
}
|
|||
|
|
return _timer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------清空房间魅力值-------------------------
|
|||
|
|
- (void)clearRoomMeiliRequest {
|
|||
|
|
[BJHttpTool clear_user_charm_allWithParameters:@{@"rid":C_string(_viewModel.roomInfo.roomId)} success:^(id response) {
|
|||
|
|
[MBProgressHUD showAutoMessage:response[@"msg"]];
|
|||
|
|
} failure:^(NSError *error) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
- (BJRoomBaomaiAlert *)userAlert{
|
|||
|
|
if (!_userAlert) {
|
|||
|
|
_userAlert = [[BJRoomBaomaiAlert alloc] initWithRoomModel:_viewModel];
|
|||
|
|
WEAK_SELF
|
|||
|
|
_userAlert.onClickUserBlock = ^(NSString *uid) {
|
|||
|
|
[weakSelf chatView:weakSelf.chatView didClickUserNameWithUserID:uid];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _userAlert;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------排行榜入口和麦下人员入口----------------
|
|||
|
|
|
|||
|
|
- (void)onAddTop3AndUsersView {
|
|||
|
|
self.top3View = [[NSBundle mainBundle] loadNibNamed:@"SPRoomTop3View" owner:self options:nil].firstObject;
|
|||
|
|
[self.view addSubview:self.top3View];
|
|||
|
|
WEAK_SELF
|
|||
|
|
[self.top3View dg_Tapped:^{
|
|||
|
|
[weakSelf.view addSubview:weakSelf.bangdanBgView];
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[self.top3View mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.centerY.mas_equalTo(self.customNavigationView);
|
|||
|
|
make.right.equalTo(self.view).offset(-50);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(75, 34));
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|||
|
|
[self onRequestTop3AndUsersView];
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onRequestTop3AndUsersView {
|
|||
|
|
NSDictionary *rankParams = @{@"rid":C_string(self.viewModel.roomInfo.roomId), @"type":@(1),@"time":@(1)};
|
|||
|
|
[AFNetworkRequset.shared postRequestWithParams:rankParams Path:@"api/room/get_room_rank" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
NSArray *arr = [SPBangDanListModel mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
|
|||
|
|
self.top3View.dataArray = arr;
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onCreateBangdanBgView {
|
|||
|
|
self.bangdanVC = [[YYRoomRankVC alloc] init];
|
|||
|
|
self.bangdanVC.rid = self.viewModel.roomInfo.roomId;
|
|||
|
|
[self addChildViewController:self.bangdanVC];
|
|||
|
|
|
|||
|
|
self.bangdanBgView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|||
|
|
|
|||
|
|
self.bangdanVC.view.frame = CGRectMake(0, ScreenHeight-521, ScreenWidth, 521);
|
|||
|
|
[self.bangdanBgView addSubview:self.bangdanVC.view];
|
|||
|
|
|
|||
|
|
UIImageView *touchImgV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight-521)];
|
|||
|
|
[self.bangdanBgView addSubview:touchImgV];
|
|||
|
|
touchImgV.backgroundColor = [kBlackColor colorWithAlphaComponent:0.5];
|
|||
|
|
touchImgV.userInteractionEnabled = YES;
|
|||
|
|
WEAK_SELF
|
|||
|
|
[touchImgV dg_Tapped:^{
|
|||
|
|
[weakSelf.bangdanBgView removeFromSuperview];
|
|||
|
|
}];
|
|||
|
|
self.bangdanVC.onDismissBlock = ^{
|
|||
|
|
[weakSelf.bangdanBgView removeFromSuperview];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UIButton *)applyUpBtn {
|
|||
|
|
if (!_applyUpBtn) {
|
|||
|
|
_applyUpBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
|||
|
|
[_applyUpBtn setImage:ImageNamed(@"room_applyUp") forState:UIControlStateNormal];
|
|||
|
|
WEAK_SELF
|
|||
|
|
[_applyUpBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
weakSelf.applyUpNumLab.hidden = YES;
|
|||
|
|
weakSelf.jyApplyUpV.viewModel = weakSelf.viewModel;
|
|||
|
|
[weakSelf.view addSubview:weakSelf.jyApplyUpV];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
}
|
|||
|
|
return _applyUpBtn;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (UILabel *)applyUpNumLab {
|
|||
|
|
if (!_applyUpNumLab) {
|
|||
|
|
_applyUpNumLab = [ControlCreator createLabel:nil rect:CGRectZero text:@"0" font:YBBoldFont(10) color:kWhiteColor backguoundColor:kRedColor align:NSTextAlignmentCenter lines:1];
|
|||
|
|
_applyUpNumLab.hidden = YES;
|
|||
|
|
_applyUpNumLab.layer.cornerRadius = 8;
|
|||
|
|
_applyUpNumLab.layer.masksToBounds = YES;
|
|||
|
|
}
|
|||
|
|
return _applyUpNumLab;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYJYApplyUpView *)jyApplyUpV {
|
|||
|
|
if (!_jyApplyUpV) {
|
|||
|
|
_jyApplyUpV = LoadNib(@"YYJYApplyUpView");
|
|||
|
|
_jyApplyUpV.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
WEAK_SELF
|
|||
|
|
_jyApplyUpV.onClickUserBlock = ^(NSString *uid) {
|
|||
|
|
[weakSelf chatView:weakSelf.chatView didClickUserNameWithUserID:uid];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _jyApplyUpV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark -------新人厅相关------
|
|||
|
|
|
|||
|
|
- (void)onCreateXinrenViews {
|
|||
|
|
if (self.viewModel.roomInfo.is_xinren != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
_xrTop3View = LoadNib(@"YYXinrenTop3View");
|
|||
|
|
_xrTop3View.hidden = YES;
|
|||
|
|
[self.view addSubview:_xrTop3View];
|
|||
|
|
[_xrTop3View mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.mas_equalTo(12);
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+80);
|
|||
|
|
make.width.mas_equalTo(114);
|
|||
|
|
make.height.mas_equalTo(138);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
NSDictionary *params = @{@"rid":self.viewModel.roomInfo.roomId};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/new_room/get_room_new_auction_rank" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
NSArray *arr = [YYXinrenTop3Model mj_objectArrayWithKeyValuesArray:responseDic[@"data"][@"list"]];
|
|||
|
|
self.xrTop3View.dataArray = arr;
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onXRQianyueResult:(NSDictionary *)dict {
|
|||
|
|
NSString *chujiaUid = [dict[@"auction_user_info"] safeStringForKey:@"uid"];
|
|||
|
|
if ([chujiaUid integerValue] == [BJUserManager.userInfo.uid integerValue]) {
|
|||
|
|
YYQianyueSelfAlert *view = LoadNib(@"YYQianyueSelfAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
view.dataDict = dict;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
}else {
|
|||
|
|
YYQianyueSuccessAlert *view = LoadNib(@"YYQianyueSuccessAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
view.dataDict = dict;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark -------拍卖厅相关------
|
|||
|
|
- (void)onCreatePaimaiViews {
|
|||
|
|
if (self.viewModel.roomInfo.is_paimai != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(425);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
- (void)onPMPaimaiResult:(NSDictionary *)dict {
|
|||
|
|
NSString *chujiaUid = [dict[@"auction_user_info"] safeStringForKey:@"uid"];
|
|||
|
|
if ([chujiaUid integerValue] == [BJUserManager.userInfo.uid integerValue]) {
|
|||
|
|
YYPMSelfAlert *view = LoadNib(@"YYPMSelfAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
view.dataDict = dict;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
}else {
|
|||
|
|
YYPMSuccessAlert *view = LoadNib(@"YYPMSuccessAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
view.dataDict = dict;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onPMAutoChooseAlert {
|
|||
|
|
if ([self.viewModel currentParticipantInfo].position == 1) {
|
|||
|
|
YYPMPickRelationView *view = LoadNib(@"YYPMPickRelationView");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
view.rid = self.viewModel.roomInfo.roomId;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------交友厅相关----------------
|
|||
|
|
|
|||
|
|
- (void)onJuageJiaoyouRoom {
|
|||
|
|
if (self.viewModel.roomInfo.is_dating != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(460);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYJYRelationView *)jyRelationV {
|
|||
|
|
if (!_jyRelationV) {
|
|||
|
|
_jyRelationV = LoadNib(@"YYJYRelationView");
|
|||
|
|
_jyRelationV.viewModel = self.viewModel;
|
|||
|
|
_jyRelationV.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
}
|
|||
|
|
return _jyRelationV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYJYSimiRoomView *)simiRoomV {
|
|||
|
|
if (!_simiRoomV) {
|
|||
|
|
_simiRoomV = LoadNib(@"YYJYSimiRoomView");
|
|||
|
|
_simiRoomV.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[_simiRoomV.bgImgV sd_setImageWithURL:URL(_viewModel.roomInfo.room_background_image) placeholderImage:ImageNamed(@"room_background")];
|
|||
|
|
WEAK_SELF
|
|||
|
|
_simiRoomV.onRollTouziBlock = ^{
|
|||
|
|
[weakSelf.viewModel bj_requestSimiTouziData];
|
|||
|
|
};
|
|||
|
|
_simiRoomV.onChangeSimiBlock = ^(BOOL close) {
|
|||
|
|
weakSelf.viewModel.roomInfo.is_send_simiMsg = close ? 2 : 1;
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _simiRoomV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------相亲厅相关----------------
|
|||
|
|
|
|||
|
|
- (void)onJuageXiangqinRoomView {
|
|||
|
|
if (self.viewModel.roomInfo.is_xiangqin != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
if (APPW > 414) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(500);
|
|||
|
|
}else {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(450);
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
// k歌厅调整公告位置
|
|||
|
|
BOOL haveAuth = self.viewModel.isRoomOwner || self.viewModel.isRoomAdministrator;
|
|||
|
|
if (haveAuth) {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(80, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}else {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(16, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
self.descBtn.hidden = NO;
|
|||
|
|
_descBtn.frame = CGRectMake(self.room_noticeBtn.right+15, yb_NavigationBar_H+15, 70, 25);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)participantsAreaXqKTVStartArea:(RCMicParticipantsArea *)participants withStage:(NSInteger)stage;
|
|||
|
|
{
|
|||
|
|
if (stage == 2){
|
|||
|
|
[_lrcView removeFromSuperview];
|
|||
|
|
_lrcView = nil;
|
|||
|
|
_lrcView = [[AgoraLrcScoreView alloc] initWithDelegate:self logDelegate:self];
|
|||
|
|
_lrcView.frame = CGRectMake(75, yb_NavigationBar_H+200, ScreenWidth-75*2, 80);
|
|||
|
|
_lrcView.downloadDelegate = self;
|
|||
|
|
_lrcView.layer.cornerRadius = 5;
|
|||
|
|
_lrcView.backgroundColor = HEXCOLORA(0x000000, 0.6);
|
|||
|
|
[self.view addSubview:_lrcView];
|
|||
|
|
|
|||
|
|
[_lrcView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.equalTo(self.chatView).offset(20);
|
|||
|
|
make.top.equalTo(self.chatView).offset(20);
|
|||
|
|
make.width.mas_equalTo(260);
|
|||
|
|
make.height.mas_equalTo(120);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
AgoraLrcScoreConfigModel *config = [[AgoraLrcScoreConfigModel alloc] init];
|
|||
|
|
config.isHiddenScoreView = YES;
|
|||
|
|
|
|||
|
|
AgoraScoreItemConfigModel *scoreConfig = [[AgoraScoreItemConfigModel alloc] init];
|
|||
|
|
config.scoreConfig = scoreConfig;
|
|||
|
|
|
|||
|
|
AgoraLrcConfigModel *lrcConfig = [[AgoraLrcConfigModel alloc] init];
|
|||
|
|
config.lrcConfig = lrcConfig;
|
|||
|
|
lrcConfig.tipsColor = mainDeepColor;
|
|||
|
|
lrcConfig.separatorLineColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcNormalColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcHighlightColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcDrawingColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcFontSize = YBMediumFont(13);
|
|||
|
|
lrcConfig.lrcHighlightFontSize = YBMediumFont(15);
|
|||
|
|
lrcConfig.maxWidth = 260;
|
|||
|
|
lrcConfig.lrcTopAndBottomMargin = 5;
|
|||
|
|
lrcConfig.waitingViewSize = 6;
|
|||
|
|
lrcConfig.isHiddenBottomMask = YES;
|
|||
|
|
lrcConfig.isHiddenWatitingView = YES;
|
|||
|
|
|
|||
|
|
_lrcView.config = config;
|
|||
|
|
|
|||
|
|
// _ktvTiaoyinBtn = [ControlCreator createButton:self.view rect:CGRectZero text:@"" font:YBBoldFont(11) color:kWhiteColor backguoundColor:nil imageName:@"xq_kgeset_image" target:self action:@selector(onKTVTiaoyin)];
|
|||
|
|
//
|
|||
|
|
// [_ktvTiaoyinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
// make.right.mas_equalTo(-16);
|
|||
|
|
// make.top.equalTo(self.participantsArea).offset(165);
|
|||
|
|
// make.width.mas_equalTo(58);
|
|||
|
|
// make.height.mas_equalTo(22);
|
|||
|
|
// }];
|
|||
|
|
|
|||
|
|
[self.songListV onShow];
|
|||
|
|
}else{
|
|||
|
|
[_ktvTiaoyinBtn removeFromSuperview];
|
|||
|
|
[_lrcView removeFromSuperview];
|
|||
|
|
_ktvTiaoyinBtn = nil;
|
|||
|
|
_lrcView = nil;
|
|||
|
|
// [self.viewModel ktv_SelfChangeSong];
|
|||
|
|
[self.viewModel ktv_DestoryKtvPlayer];
|
|||
|
|
self.viewModel.playPosition = 0;
|
|||
|
|
self.viewModel.isHechang = NO;
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)participantsAreaXqSet:(RCMicParticipantsArea *)participants withStage:(NSInteger)stage {
|
|||
|
|
[self.songSettingV onShow];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)xiangqinHechangLrcView
|
|||
|
|
{
|
|||
|
|
if (_lrcView){
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
_lrcView = [[AgoraLrcScoreView alloc] initWithDelegate:self logDelegate:self];
|
|||
|
|
_lrcView.frame = CGRectMake(75, yb_NavigationBar_H+200, ScreenWidth-75*2, 80);
|
|||
|
|
_lrcView.downloadDelegate = self;
|
|||
|
|
_lrcView.layer.cornerRadius = 5;
|
|||
|
|
_lrcView.backgroundColor = HEXCOLORA(0x000000, 0.6);
|
|||
|
|
[self.view addSubview:_lrcView];
|
|||
|
|
|
|||
|
|
[_lrcView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.equalTo(self.chatView).offset(20);
|
|||
|
|
make.top.equalTo(self.chatView).offset(20);
|
|||
|
|
make.width.mas_equalTo(260);
|
|||
|
|
make.height.mas_equalTo(120);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
AgoraLrcScoreConfigModel *config = [[AgoraLrcScoreConfigModel alloc] init];
|
|||
|
|
config.isHiddenScoreView = YES;
|
|||
|
|
|
|||
|
|
AgoraScoreItemConfigModel *scoreConfig = [[AgoraScoreItemConfigModel alloc] init];
|
|||
|
|
config.scoreConfig = scoreConfig;
|
|||
|
|
|
|||
|
|
AgoraLrcConfigModel *lrcConfig = [[AgoraLrcConfigModel alloc] init];
|
|||
|
|
config.lrcConfig = lrcConfig;
|
|||
|
|
lrcConfig.tipsColor = mainDeepColor;
|
|||
|
|
lrcConfig.separatorLineColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcNormalColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcHighlightColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcDrawingColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcFontSize = YBMediumFont(13);
|
|||
|
|
lrcConfig.lrcHighlightFontSize = YBMediumFont(15);
|
|||
|
|
lrcConfig.maxWidth = 260;
|
|||
|
|
lrcConfig.lrcTopAndBottomMargin = 5;
|
|||
|
|
lrcConfig.waitingViewSize = 6;
|
|||
|
|
lrcConfig.isHiddenBottomMask = YES;
|
|||
|
|
lrcConfig.isHiddenWatitingView = YES;
|
|||
|
|
|
|||
|
|
_lrcView.config = config;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)participantsAreaXiangqinStageBimai
|
|||
|
|
{
|
|||
|
|
RCMicMicrophoneState micState = RCMicMicrophoneStateSilent;
|
|||
|
|
[self setMicrophoneState:micState];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------酒吧相亲厅相关----------------
|
|||
|
|
|
|||
|
|
- (void)onJuageXiangqinJiubaRoom {
|
|||
|
|
if (self.viewModel.roomInfo.is_blind_date != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(420);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark ------------------挂件礼物信息----------------
|
|||
|
|
|
|||
|
|
- (void)onRequestPendantGiftData {
|
|||
|
|
NSDictionary *params = @{@"rid":C_string(self.viewModel.roomInfo.roomId)};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:@"/api/dating_room/get_room_pendant_gift_info" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
NSInteger uid = [responseDic[@"data"][@"user_info"] safeIntForKey:@"uid"];
|
|||
|
|
if (uid > 0) {
|
|||
|
|
self.pendantGiftV.dataDict = responseDic[@"data"];
|
|||
|
|
[self.view addSubview:self.pendantGiftV];
|
|||
|
|
}
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYJYPendantGiftView *)pendantGiftV {
|
|||
|
|
if (!_pendantGiftV) {
|
|||
|
|
_pendantGiftV = LoadNib(@"YYJYPendantGiftView");
|
|||
|
|
_pendantGiftV.frame = CGRectMake(0, yb_NavigationBar_H+340, 150, 180);
|
|||
|
|
}
|
|||
|
|
return _pendantGiftV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark - mp4 hwd delegate
|
|||
|
|
|
|||
|
|
- (void)vapWrap_viewDidStopPlayMP4:(NSInteger)lastFrameIndex view:(VAPView *)container {
|
|||
|
|
//回到主线程
|
|||
|
|
dispatch_async(dispatch_get_main_queue(),^{
|
|||
|
|
if (container == self.jySimiVapView) {
|
|||
|
|
[self.jySimiVapView removeFromSuperview];
|
|||
|
|
}else if (container == self.luckyVapView) {
|
|||
|
|
[self.luckyVapView removeFromSuperview];
|
|||
|
|
}
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (QGVAPWrapView *)jySimiVapView {
|
|||
|
|
if (!_jySimiVapView) {
|
|||
|
|
_jySimiVapView = [[QGVAPWrapView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|||
|
|
_jySimiVapView.hwd_Delegate = self;
|
|||
|
|
_jySimiVapView.contentMode = QGVAPWrapViewContentModeScaleToFill;
|
|||
|
|
_jySimiVapView.userInteractionEnabled = NO;
|
|||
|
|
// _jySimiVapView.autoDestoryAfterFinish = NO;
|
|||
|
|
}
|
|||
|
|
return _jySimiVapView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark -------K歌厅独有UI------
|
|||
|
|
- (void)onCreateKTVViews {
|
|||
|
|
if (self.viewModel.roomInfo.is_song != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(460);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
_ktvStartBtn = [ControlCreator createButton:self.view rect:CGRectZero text:nil font:nil color:nil backguoundColor:nil imageName:@"ktv_host_start" target:self action:@selector(onKTVStart)];
|
|||
|
|
_ktvNextBtn = [ControlCreator createButton:self.view rect:CGRectMake(0, 0, 45, 80) text:@"" font:YBMediumFont(13) color:kWhiteColor backguoundColor:nil imageName:@"ktv_qiege" target:self action:@selector(onKTVNext)];
|
|||
|
|
_ktvNextBtn.hidden = YES;
|
|||
|
|
// [_ktvNextBtn ba_button_setButtonLayoutType:BAKit_ButtonLayoutTypeCenterImageTop padding:3];
|
|||
|
|
// [self.view addSubview:self.ktvChujiaInfoV];
|
|||
|
|
[self.view addSubview:self.ktvCenterV];
|
|||
|
|
_ktvTiaoyinBtn = [ControlCreator createButton:self.view rect:CGRectZero text:nil font:nil color:nil backguoundColor:nil imageName:@"ktv_tiaoyin" target:self action:@selector(onKTVTiaoyin)];
|
|||
|
|
_ktvDiangeBtn = [ControlCreator createButton:self.view rect:CGRectZero text:nil font:nil color:nil backguoundColor:nil imageName:@"ktv_diange" target:self action:@selector(onKTVDiange)];
|
|||
|
|
_ktvDiangeBtn.hidden = YES;
|
|||
|
|
|
|||
|
|
[_ktvStartBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.centerX.mas_equalTo(0);
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+10);
|
|||
|
|
}];
|
|||
|
|
[_ktvNextBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.mas_equalTo(45);
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+100);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(50, 50));
|
|||
|
|
}];
|
|||
|
|
// [self.ktvChujiaInfoV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
// make.left.mas_equalTo(12);
|
|||
|
|
// make.top.mas_equalTo(yb_NavigationBar_H+45);
|
|||
|
|
// make.size.mas_equalTo(CGSizeMake(114, 190));
|
|||
|
|
// }];
|
|||
|
|
[self.ktvCenterV mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.centerX.mas_equalTo(0);
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+10);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(120, 220));
|
|||
|
|
}];
|
|||
|
|
[_ktvTiaoyinBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.right.mas_equalTo(-15);
|
|||
|
|
make.bottom.equalTo(self.applyUpBtn.mas_top).offset(-8);
|
|||
|
|
}];
|
|||
|
|
[_ktvDiangeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.centerX.equalTo(_ktvCenterV);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
_lrcView = [[AgoraLrcScoreView alloc] initWithDelegate:self logDelegate:self];
|
|||
|
|
_lrcView.hidden = YES;
|
|||
|
|
_lrcView.frame = CGRectMake(75, yb_NavigationBar_H+200, ScreenWidth-75*2, 80);
|
|||
|
|
_lrcView.downloadDelegate = self;
|
|||
|
|
_lrcView.layer.cornerRadius = 5;
|
|||
|
|
[self.view addSubview:_lrcView];
|
|||
|
|
|
|||
|
|
AgoraLrcScoreConfigModel *config = [[AgoraLrcScoreConfigModel alloc] init];
|
|||
|
|
config.isHiddenScoreView = YES;
|
|||
|
|
|
|||
|
|
AgoraScoreItemConfigModel *scoreConfig = [[AgoraScoreItemConfigModel alloc] init];
|
|||
|
|
config.scoreConfig = scoreConfig;
|
|||
|
|
|
|||
|
|
AgoraLrcConfigModel *lrcConfig = [[AgoraLrcConfigModel alloc] init];
|
|||
|
|
config.lrcConfig = lrcConfig;
|
|||
|
|
lrcConfig.tipsColor = mainDeepColor;
|
|||
|
|
lrcConfig.separatorLineColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcNormalColor = kWhiteColor;
|
|||
|
|
lrcConfig.lrcHighlightColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcDrawingColor = mainDeepColor;
|
|||
|
|
lrcConfig.lrcFontSize = YBMediumFont(13);
|
|||
|
|
lrcConfig.lrcHighlightFontSize = YBMediumFont(15);
|
|||
|
|
lrcConfig.maxWidth = ScreenWidth-75*2;
|
|||
|
|
lrcConfig.lrcTopAndBottomMargin = 5;
|
|||
|
|
lrcConfig.waitingViewSize = 6;
|
|||
|
|
lrcConfig.isHiddenBottomMask = YES;
|
|||
|
|
lrcConfig.isHiddenWatitingView = YES;
|
|||
|
|
|
|||
|
|
_lrcView.config = config;
|
|||
|
|
|
|||
|
|
// UIView *blackView = [[UIView alloc] initWithFrame:_lrcView.bounds];
|
|||
|
|
// blackView.backgroundColor = HEXCOLORA(0x000000, 0.2);
|
|||
|
|
// blackView.userInteractionEnabled = NO;
|
|||
|
|
// [_lrcView insertSubview:blackView atIndex:0];
|
|||
|
|
|
|||
|
|
// k歌厅调整公告位置
|
|||
|
|
BOOL haveAuth = self.viewModel.isRoomOwner || self.viewModel.isRoomAdministrator;
|
|||
|
|
if (haveAuth) {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(80, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}else {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(16, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//歌词下载完成监听
|
|||
|
|
- (void)downloadLrcFinishedWithUrl:(NSString *)url {
|
|||
|
|
[_lrcView start];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (NSTimeInterval)getPlayerCurrentTime {
|
|||
|
|
return _viewModel.playPosition;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVStart {
|
|||
|
|
NSString *urlStr = @"/api/ktv_room/open_auction";
|
|||
|
|
NSDictionary *params = @{@"rid":C_string(self.viewModel.roomInfo.roomId)};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:urlStr Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVNext {
|
|||
|
|
// [self.viewModel ktv_SelfChangeSong];
|
|||
|
|
|
|||
|
|
NSString *urlStr = @"/api/ktv_room/finish_user_song";
|
|||
|
|
NSDictionary *params = @{@"rid":C_string(self.viewModel.roomInfo.roomId), @"user_id":C_string(self.ktvCurrentUid)};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:urlStr Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVTiaoyin {
|
|||
|
|
[self.songSettingV onShow];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVDiange {
|
|||
|
|
[self.songListV onShow];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//更新K歌厅UI
|
|||
|
|
- (void)onUpdateKTVStatusWith:(NSDictionary *)dataDict {
|
|||
|
|
self.ktvCurrentUid = [dataDict[@"room_song_info"][@"user_info"] safeStringForKey:@"uid"];
|
|||
|
|
self.ktvZhizuoUid = [dataDict[@"room_song_info"][@"producer_info"] safeStringForKey:@"uid"];
|
|||
|
|
|
|||
|
|
_lrcView.hidden = YES;
|
|||
|
|
//K歌房状态 1未开始 2唱歌阶段 3签约阶段
|
|||
|
|
NSInteger status = [dataDict safeIntForKey:@"room_song_status"];
|
|||
|
|
|
|||
|
|
self.viewModel.songCurrentUid = self.ktvCurrentUid;
|
|||
|
|
self.viewModel.songCurrentStatus = status;
|
|||
|
|
|
|||
|
|
if (status == 1) {
|
|||
|
|
_ktvStartBtn.hidden = ![self.viewModel isRoomHost];
|
|||
|
|
_ktvNextBtn.hidden = YES;
|
|||
|
|
// _ktvChujiaInfoV.hidden = YES;
|
|||
|
|
_ktvCenterV.hidden = YES;
|
|||
|
|
}else if (status == 2) {
|
|||
|
|
_ktvStartBtn.hidden = YES;
|
|||
|
|
_ktvNextBtn.hidden = ![self.viewModel isRoomHost];
|
|||
|
|
// _ktvChujiaInfoV.hidden = YES;
|
|||
|
|
_ktvCenterV.hidden = NO;
|
|||
|
|
[_ktvCenterV onUpdateUIWith:dataDict isHost:[self.viewModel isRoomHost]];
|
|||
|
|
if ([self.ktvCurrentUid integerValue] == [BJUserManager.userInfo.uid integerValue]) {
|
|||
|
|
_lrcView.hidden = NO;
|
|||
|
|
[_viewModel ktv_UpdateSelfSong];
|
|||
|
|
}
|
|||
|
|
}else if (status == 3) {
|
|||
|
|
_ktvStartBtn.hidden = YES;
|
|||
|
|
_ktvNextBtn.hidden = ![self.viewModel isRoomHost];
|
|||
|
|
// _ktvChujiaInfoV.hidden = NO;
|
|||
|
|
_ktvCenterV.hidden = NO;
|
|||
|
|
// _ktvChujiaInfoV.dataDict = dataDict;
|
|||
|
|
[_ktvCenterV onUpdateUIWith:dataDict isHost:[self.viewModel isRoomHost]];
|
|||
|
|
if ([self.ktvCurrentUid integerValue] == [BJUserManager.userInfo.uid integerValue]) {
|
|||
|
|
//伴奏关掉
|
|||
|
|
[_viewModel ktv_DestoryKtvPlayer];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
NSDictionary *singInfo = dataDict[@"room_song_info"][@"user_info"];
|
|||
|
|
if ([singInfo safeIntForKey:@"uid"] == [BJUserManager.userInfo.uid integerValue]) {
|
|||
|
|
_ktvTiaoyinBtn.hidden = NO;
|
|||
|
|
}else {
|
|||
|
|
_ktvTiaoyinBtn.hidden = YES;
|
|||
|
|
}
|
|||
|
|
if (status != 3 && [self.viewModel currentParticipantInfo].position >= 1 && [self.viewModel currentParticipantInfo].position <= 4) {
|
|||
|
|
_ktvDiangeBtn.hidden = NO;
|
|||
|
|
} else {
|
|||
|
|
_ktvDiangeBtn.hidden = YES;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
[self.participantsArea onKTVChangeStatus:status > 1];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVChujia {
|
|||
|
|
YYRoomChujiaAlert *view = LoadNib(@"YYRoomChujiaAlert");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
view.rid = self.viewModel.roomInfo.roomId;
|
|||
|
|
view.is_ktv = YES;
|
|||
|
|
view.ktvCurrentUid = self.ktvCurrentUid;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onKTVEnd {
|
|||
|
|
NSString *urlStr = @"/api/ktv_room/finish_auction";
|
|||
|
|
NSDictionary *params = @{@"rid":C_string(self.viewModel.roomInfo.roomId), @"user_id":C_string(self.ktvCurrentUid)};
|
|||
|
|
[[AFNetworkRequset shared] postRequestWithParams:params Path:urlStr Loading:YES Hud:YES Success:^(id _Nonnull responseDic) {
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYKTVChujiaInfoView *)ktvChujiaInfoV {
|
|||
|
|
if (!_ktvChujiaInfoV) {
|
|||
|
|
_ktvChujiaInfoV = LoadNib(@"YYKTVChujiaInfoView");
|
|||
|
|
_ktvChujiaInfoV.hidden = YES;
|
|||
|
|
}
|
|||
|
|
return _ktvChujiaInfoV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (YYKTVCenterView *)ktvCenterV {
|
|||
|
|
if (!_ktvCenterV) {
|
|||
|
|
_ktvCenterV = LoadNib(@"YYKTVCenterView");
|
|||
|
|
_ktvCenterV.hidden = YES;
|
|||
|
|
WEAK_SELF
|
|||
|
|
[_ktvCenterV.chujiaBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
[weakSelf onKTVChujia];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
|
|||
|
|
[_ktvCenterV.hostChujiaBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
[weakSelf onKTVChujia];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
|
|||
|
|
[_ktvCenterV.hostEndBtn buttonAddTaget:^(UIButton *btn) {
|
|||
|
|
[weakSelf onKTVEnd];
|
|||
|
|
} forControlEvents:UIControlEventTouchUpInside];
|
|||
|
|
|
|||
|
|
[_ktvCenterV.singAvatarImgV dg_Tapped:^{
|
|||
|
|
if ([weakSelf.ktvCurrentUid integerValue] > 0) {
|
|||
|
|
[weakSelf chatView:weakSelf.chatView didClickUserNameWithUserID:weakSelf.ktvCurrentUid];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
[_ktvCenterV.zhizuoAvatarImgV dg_Tapped:^{
|
|||
|
|
if ([weakSelf.ktvZhizuoUid integerValue] > 0) {
|
|||
|
|
[UIViewController goUserMainpageWith:weakSelf.ktvZhizuoUid withRid:@""];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
return _ktvCenterV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RoomSongView *)songListV {
|
|||
|
|
if (!_songListV) {
|
|||
|
|
_songListV = [[RoomSongView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, ScreenHeight)];
|
|||
|
|
_songListV.viewModel = self.viewModel;
|
|||
|
|
}
|
|||
|
|
return _songListV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RoomSongSettingView *)songSettingV {
|
|||
|
|
if (!_songSettingV) {
|
|||
|
|
_songSettingV = LoadNib(@"RoomSongSettingView");
|
|||
|
|
_songSettingV.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
_songSettingV.viewModel = self.viewModel;
|
|||
|
|
}
|
|||
|
|
return _songSettingV;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark -------抢头条--------
|
|||
|
|
|
|||
|
|
- (void)onRequestCurrentLaba {
|
|||
|
|
NSDictionary *rankParams = @{};
|
|||
|
|
[AFNetworkRequset.shared postRequestWithParams:rankParams Path:@"/api/user_top_line/get_user_top_line_list" Loading:NO Hud:NO Success:^(id _Nonnull responseDic) {
|
|||
|
|
[self onReceiveLaba:responseDic[@"data"]];
|
|||
|
|
|
|||
|
|
} Failure:^(id _Nonnull errorData) {
|
|||
|
|
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onReceiveLaba:(NSDictionary *)dataDict {
|
|||
|
|
NSLog(@"dataDict : %@",dataDict);
|
|||
|
|
|
|||
|
|
SEARoomHeadlineModel *model = [SEARoomHeadlineModel mj_objectWithKeyValues:dataDict];
|
|||
|
|
self.endTime = model.over_time;
|
|||
|
|
[self.GBTimer startGCDTimer:1 delegate:self];
|
|||
|
|
[self.view addSubview:self.headlineShowView];
|
|||
|
|
self.headlineShowView.model = model;
|
|||
|
|
_headlineShowView.hidden = NO;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (void)onTimerFired:(ZWTimer *)timer {
|
|||
|
|
if (timer == self.GBTimer) {
|
|||
|
|
self.endTime = self.endTime-1;
|
|||
|
|
if (self.endTime<=0){
|
|||
|
|
[self.GBTimer stopTimer];
|
|||
|
|
[self.headlineShowView removeFromSuperview];
|
|||
|
|
}
|
|||
|
|
}else if (timer == self.timer) {
|
|||
|
|
self.leftSecond -= 1;
|
|||
|
|
if (self.leftSecond < 0) {
|
|||
|
|
self.leftSecond = 0;
|
|||
|
|
[self.timer stopTimer];
|
|||
|
|
}
|
|||
|
|
self.blindShowV.leftTimeL.text = [NSString stringWithFormat:@"剩余时间:%02ld:%02ld", self.leftSecond/60, self.leftSecond%60];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (ZWTimer *)GBTimer {
|
|||
|
|
if (!_GBTimer) {
|
|||
|
|
_GBTimer = [[ZWTimer alloc] init];
|
|||
|
|
}
|
|||
|
|
return _GBTimer;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
- (SEARoomHeadlineShowView *)headlineShowView
|
|||
|
|
{
|
|||
|
|
if (!_headlineShowView){
|
|||
|
|
_headlineShowView = LoadNib(@"SEARoomHeadlineShowView");
|
|||
|
|
_headlineShowView.hidden = YES;
|
|||
|
|
_headlineShowView.frame = CGRectMake(0, yb_NavigationBar_H+380, 300, 60);
|
|||
|
|
|
|||
|
|
WEAK_SELF;
|
|||
|
|
_headlineShowView.goBlock = ^{
|
|||
|
|
[weakSelf showRoomHeadlinePublishView];
|
|||
|
|
};
|
|||
|
|
_headlineShowView.caiBlock = ^(NSString * _Nonnull rid) {
|
|||
|
|
if (![rid isEqualToString:weakSelf.viewModel.roomInfo.roomId]){
|
|||
|
|
[UIViewController goMicRoomWithRid:rid withPwd:@""];
|
|||
|
|
}else{
|
|||
|
|
[HelpPageDefine showMessage:@"当前房间无需跳转"];
|
|||
|
|
}
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
return _headlineShowView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//广播头条
|
|||
|
|
- (void)showRoomHeadlinePublishView
|
|||
|
|
{
|
|||
|
|
SEARoomHeadlinesPublishView *publishv = LoadNib(@"SEARoomHeadlinesPublishView");
|
|||
|
|
publishv.frame = CGRectMake(0, 0, APPW, APPH);
|
|||
|
|
publishv.rid = self.viewModel.roomInfo.roomId;
|
|||
|
|
[[UIViewController currentViewController].view addSubview:publishv];
|
|||
|
|
[publishv sheetViewforViewAppear];
|
|||
|
|
publishv.topUpButtonClickBlock = ^{
|
|||
|
|
[UIViewController goRechageCtrl];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark --------- 游戏的东西先写这里 ----------
|
|||
|
|
|
|||
|
|
- (void)onSudJuageGameRoom {
|
|||
|
|
if (self.viewModel.roomInfo.is_Game == 1) {
|
|||
|
|
|
|||
|
|
[self onSudCreateGameUI];
|
|||
|
|
|
|||
|
|
// 创建SudMDPWrapper
|
|||
|
|
[self createSudMGPWrapper];
|
|||
|
|
if (self.viewModel.roomInfo.game_status == 1) {
|
|||
|
|
[self onSudLoginGame];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudCreateGameUI {
|
|||
|
|
self.gameView = [[UIView alloc] init];
|
|||
|
|
[self.view insertSubview:self.gameView aboveSubview:self.backgroundView];
|
|||
|
|
[self.gameView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.edges.equalTo(self.view);
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
if (self.viewModel.isRoomOwner || self.viewModel.roomInfo.is_host == 1) {
|
|||
|
|
UIButton *pickBtn = [ControlCreator createButton:self.view rect:CGRectZero text:@"选择游戏" font:YBMediumFont(10) color:kBlackColor backguoundColor:[kWhiteColor colorWithAlphaComponent:0.1] imageName:nil target:self action:@selector(onSudHostPickGame)];
|
|||
|
|
pickBtn.layer.cornerRadius = 10;
|
|||
|
|
pickBtn.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(60, 20) direction:(FXGradientChangeDirectionHorizontal) startColor:mainLightColor endColor:mainDeepColor];
|
|||
|
|
|
|||
|
|
UIButton *endBtn = [ControlCreator createButton:self.view rect:CGRectZero text:@"关闭游戏" font:YBMediumFont(10) color:kBlackColor backguoundColor:[kWhiteColor colorWithAlphaComponent:0.1] imageName:nil target:self action:@selector(onSudHostEndGame)];
|
|||
|
|
endBtn.layer.cornerRadius = 10;
|
|||
|
|
endBtn.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(60, 20) direction:(FXGradientChangeDirectionHorizontal) startColor:mainLightColor endColor:mainDeepColor];
|
|||
|
|
|
|||
|
|
[endBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+20);
|
|||
|
|
make.right.mas_equalTo(-16-60-10);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(60, 20));
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
[pickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(endBtn);
|
|||
|
|
make.right.equalTo(endBtn.mas_left).offset(-10);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(60, 20));
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
UIButton *pickBtn = [ControlCreator createButton:self.view rect:CGRectZero text:@"隐藏麦位" font:YBMediumFont(10) color:kBlackColor backguoundColor:[kWhiteColor colorWithAlphaComponent:0.1] imageName:nil target:self action:@selector(hiddenParticipantsAreaMethod:)];
|
|||
|
|
[pickBtn setTitle:@"显示麦位" forState:(UIControlStateSelected)];
|
|||
|
|
pickBtn.layer.cornerRadius = 10;
|
|||
|
|
pickBtn.backgroundColor = [UIColor bm_colorGradientChangeWithSize:CGSizeMake(60, 20) direction:(FXGradientChangeDirectionHorizontal) startColor:mainLightColor endColor:mainDeepColor];
|
|||
|
|
|
|||
|
|
[pickBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.mas_equalTo(yb_NavigationBar_H+20);
|
|||
|
|
make.right.mas_equalTo(-16);
|
|||
|
|
make.size.mas_equalTo(CGSizeMake(60, 20));
|
|||
|
|
}];
|
|||
|
|
|
|||
|
|
|
|||
|
|
//更改麦位布局
|
|||
|
|
[self.participantsArea mas_remakeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(40);
|
|||
|
|
make.left.right.mas_equalTo(0);
|
|||
|
|
make.height.mas_equalTo(100);
|
|||
|
|
}];
|
|||
|
|
// [self.participantsArea onChangeGameUI];
|
|||
|
|
|
|||
|
|
// 游戏厅调整公告位置
|
|||
|
|
BOOL haveAuth = self.viewModel.isRoomOwner || self.viewModel.isRoomAdministrator;
|
|||
|
|
if (haveAuth) {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(80, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}else {
|
|||
|
|
_room_noticeBtn.frame = CGRectMake(16, yb_NavigationBar_H+15, 50, 25);
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)hiddenParticipantsAreaMethod:(UIButton *)btn
|
|||
|
|
{
|
|||
|
|
btn.selected = !btn.selected;
|
|||
|
|
self.participantsArea.hidden = self.publicSelectView.hidden = !self.participantsArea.hidden;
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudHostPickGame {
|
|||
|
|
YYRoomGamePickView *view = LoadNib(@"YYRoomGamePickView");
|
|||
|
|
view.frame = [UIScreen mainScreen].bounds;
|
|||
|
|
[MainWindow() addSubview:view];
|
|||
|
|
WEAK_SELF
|
|||
|
|
view.onPickGameBlock = ^(NSString * _Nonnull gameId) {
|
|||
|
|
weakSelf.viewModel.roomInfo.game_id = gameId;
|
|||
|
|
[weakSelf onSudHostStartGame];
|
|||
|
|
};
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudHostStartGame {
|
|||
|
|
NSDictionary *paramDict = @{@"rid":C_string(_viewModel.roomInfo.roomId), @"game_id":C_string(_viewModel.roomInfo.game_id)};
|
|||
|
|
[RCMicHTTP requestWithHTTPMethod:RCMicHTTPMethodPost URLString:@"/api/room/room_game_start" parameters:paramDict response:^(RCMicHTTPResult *result) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
[SVProgressHUD showSuccessWithStatus:result.message];
|
|||
|
|
} else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudHostEndGame {
|
|||
|
|
NSDictionary *paramDict = @{@"rid":C_string(_viewModel.roomInfo.roomId), @"game_id":C_string(_viewModel.roomInfo.game_id)};
|
|||
|
|
[RCMicHTTP requestWithHTTPMethod:RCMicHTTPMethodPost URLString:@"/api/room/room_game_end" parameters:paramDict response:^(RCMicHTTPResult *result) {
|
|||
|
|
if (result.errorCode == 200) {
|
|||
|
|
[SVProgressHUD showSuccessWithStatus:result.message];
|
|||
|
|
} else {
|
|||
|
|
[SVProgressHUD showInfoWithStatus:result.message];
|
|||
|
|
}
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudLoginGame {
|
|||
|
|
// 配置加载SudMGP必须参数
|
|||
|
|
SudMGPLoadConfigModel *sudGameConfigModel = [[SudMGPLoadConfigModel alloc] init];
|
|||
|
|
sudGameConfigModel.gameId = [self.viewModel.roomInfo.game_id integerValue];
|
|||
|
|
sudGameConfigModel.roomId = self.viewModel.roomInfo.roomId;
|
|||
|
|
sudGameConfigModel.language = @"zh-CN";
|
|||
|
|
sudGameConfigModel.gameView = self.gameView;
|
|||
|
|
sudGameConfigModel.userId = BJUserManager.userInfo.uid;
|
|||
|
|
self.sudMGPLoadConfigModel = sudGameConfigModel;
|
|||
|
|
|
|||
|
|
// 登录游戏
|
|||
|
|
if (self.sudMGPLoadConfigModel.gameId > 0) {
|
|||
|
|
[self loginGame:self.sudMGPLoadConfigModel];
|
|||
|
|
[self onSudUpdateChatUI];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudLogoutGame {
|
|||
|
|
[self logoutGame];
|
|||
|
|
[self onSudUpdateChatUI];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onSudUpdateChatUI {
|
|||
|
|
if (self.viewModel.roomInfo.is_Game != 1) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
if (self.viewModel.roomInfo.game_status == 1) {
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(APPW/375*540);
|
|||
|
|
}];
|
|||
|
|
}else {
|
|||
|
|
[self.chatView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.top.equalTo(self.customNavigationView.mas_bottom).offset(305);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onUpdateGameMsg:(NSString *)str {
|
|||
|
|
[self.viewModel bj_sendSudGameMsg:str];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (BOOL)onGetIsRoomOwner {
|
|||
|
|
return [self.viewModel isRoomOwner];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)setGameBanMic:(BOOL)gameBanMic {
|
|||
|
|
_gameBanMic = gameBanMic;
|
|||
|
|
|
|||
|
|
_viewModel.gameBanMic = gameBanMic;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)setGameBanSpeaker:(BOOL)gameBanSpeaker {
|
|||
|
|
_gameBanSpeaker = gameBanSpeaker;
|
|||
|
|
|
|||
|
|
_viewModel.gameBanSpeaker = gameBanSpeaker;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onChangeGameMic:(BOOL)open {
|
|||
|
|
[self.viewModel setUseMicrophone:open];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onChangeGameSpeaker:(BOOL)open {
|
|||
|
|
[self.viewModel setUseSpeaker:open];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
#pragma mark -------实时筛选公屏消息--------
|
|||
|
|
|
|||
|
|
- (void)onChangeSelectChat {
|
|||
|
|
NSArray *indexs = @[];
|
|||
|
|
if ([GVUSER.publicType intValue] == 1) {//私聊
|
|||
|
|
indexs = @[@(self.viewModel.siliaoMsgArray.count - 1)];
|
|||
|
|
}else if ([GVUSER.publicType intValue] == 2) {//@频道
|
|||
|
|
indexs = @[@(self.viewModel.atMsgArray.count - 1)];
|
|||
|
|
}else if ([GVUSER.publicType intValue] == 3) {//系统
|
|||
|
|
indexs = @[@(self.viewModel.systemMsgArray.count - 1)];
|
|||
|
|
}else {
|
|||
|
|
indexs = @[@(self.viewModel.messageDataSource.count - 1)];
|
|||
|
|
}
|
|||
|
|
[self.chatView updateTableViewWithType:RCMicMessageChangedTypeReload indexs:indexs];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (RoomMusicView *)musicView {
|
|||
|
|
if (!_musicView) {
|
|||
|
|
_musicView = [[RoomMusicView alloc] initWithViewModel:self.viewModel];
|
|||
|
|
}
|
|||
|
|
return _musicView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
#pragma mark -------------爆币礼物托盘-------------
|
|||
|
|
|
|||
|
|
- (void)onShowGiftTuopanWith:(NSDictionary *)dict {
|
|||
|
|
TCCustomMessageModel *model = [[TCCustomMessageModel alloc] init];
|
|||
|
|
NSString *identity = [NSString stringWithFormat:@"%@%@%@", dict[@"send_user_info"][@"uid"], dict[@"recived_user_info"][@"uid"], [dict safeStringForKey:@"gift_name"]];
|
|||
|
|
model.imUserId = identity;
|
|||
|
|
model.imUserName = C_string(dict[@"send_user_info"][@"nick_name"]);
|
|||
|
|
model.imUserIconUrl = C_string(dict[@"send_user_info"][@"head_pic"]);
|
|||
|
|
model.giftUrl = [dict safeStringForKey:@"base_image"];
|
|||
|
|
model.msg = [NSString stringWithFormat:@"赠送了 %@", dict[@"recived_user_info"][@"nick_name"]];
|
|||
|
|
model.win_multiple = [dict safeIntForKey:@"win_multiple"];
|
|||
|
|
[self.lianjiView sendGiftWith:model];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)onShowLuckyVapWith:(NSDictionary *)dict {
|
|||
|
|
if (GVUSER.closeGiftEffect) {
|
|||
|
|
return;
|
|||
|
|
}
|
|||
|
|
//翻倍礼物倍数,可以用来判断
|
|||
|
|
NSInteger win_multiple = [dict safeIntForKey:@"win_multiple"];
|
|||
|
|
if (win_multiple >= 30) {//30倍以上才有动画
|
|||
|
|
NSString *vapStr = @"1_满贯元宝";
|
|||
|
|
if (win_multiple <= 300) {
|
|||
|
|
vapStr = @"1_满贯元宝";
|
|||
|
|
}else if (win_multiple < 500) {
|
|||
|
|
vapStr = @"2_财神到";
|
|||
|
|
}else if (win_multiple < 1000) {
|
|||
|
|
vapStr = @"3_宝藏";
|
|||
|
|
}else if (win_multiple >= 1000) {
|
|||
|
|
vapStr = @"4_恭喜发财";
|
|||
|
|
}
|
|||
|
|
[self.view addSubview:self.luckyVapView];
|
|||
|
|
NSString *path = [[NSBundle mainBundle] pathForResource:vapStr ofType:@"mp4"];
|
|||
|
|
[self.luckyVapView playHWDMP4:path repeatCount:0 delegate:self];
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (GiftTableView *)lianjiView {
|
|||
|
|
if (!_lianjiView) {
|
|||
|
|
_lianjiView = [[GiftTableView alloc] init];
|
|||
|
|
_lianjiView.backgroundColor = [UIColor clearColor];
|
|||
|
|
_lianjiView.userInteractionEnabled = NO;
|
|||
|
|
[self.view addSubview:_lianjiView];
|
|||
|
|
[_lianjiView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|||
|
|
make.left.right.mas_equalTo(self.view);
|
|||
|
|
make.height.mas_equalTo(140);
|
|||
|
|
make.top.mas_equalTo(self.view).offset(250);
|
|||
|
|
}];
|
|||
|
|
}
|
|||
|
|
return _lianjiView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (QGVAPWrapView *)luckyVapView {
|
|||
|
|
if (!_luckyVapView) {
|
|||
|
|
_luckyVapView = [[QGVAPWrapView alloc] initWithFrame:[UIScreen mainScreen].bounds];
|
|||
|
|
_luckyVapView.hwd_Delegate = self;
|
|||
|
|
_luckyVapView.contentMode = QGVAPWrapViewContentModeScaleToFill;
|
|||
|
|
_luckyVapView.userInteractionEnabled = NO;
|
|||
|
|
}
|
|||
|
|
return _luckyVapView;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
//排行榜弹出麦位弹框,暂时没更方便的办法
|
|||
|
|
- (void)onRankPopUserAlert:(NSString *)uid {
|
|||
|
|
[self chatView:self.chatView didClickUserNameWithUserID:uid];
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
- (void)showCPInfoTxVapWithDict:(NSDictionary *)dict
|
|||
|
|
{
|
|||
|
|
LMCPInRoomVapView *vapView = LoadNib(@"LMCPInRoomVapView");
|
|||
|
|
vapView.frame = CGRectMake(0, 0, APPW, APPH);
|
|||
|
|
[self.view addSubview:vapView];
|
|||
|
|
[vapView playVapWithDict:dict];
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
@end
|