2021-12-15 18:12:55 +08:00
|
|
|
|
//
|
|
|
|
|
// XPRoomFunctionContainerView.m
|
|
|
|
|
// xplan-ios
|
|
|
|
|
//
|
|
|
|
|
// Created by 冯硕 on 2021/12/15.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#import "XPRoomFunctionContainerView.h"
|
2022-01-06 11:12:32 +08:00
|
|
|
|
///Third
|
|
|
|
|
#import <Masonry/Masonry.h>
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#import <ReactiveObjC/ReactiveObjC.h>
|
|
|
|
|
#import <NIMSDK/NIMSDK.h>
|
2022-04-19 16:45:32 +08:00
|
|
|
|
#import <POP.h>
|
2021-12-15 18:12:55 +08:00
|
|
|
|
///Tool
|
|
|
|
|
#import "XPMacro.h"
|
2022-01-06 11:12:32 +08:00
|
|
|
|
#import "AccountInfoStorage.h"
|
|
|
|
|
#import "UIImage+Utils.h"
|
|
|
|
|
#import "ThemeColor.h"
|
2022-01-14 11:38:09 +08:00
|
|
|
|
#import "TTPopup.h"
|
2022-01-06 11:12:32 +08:00
|
|
|
|
#import "Api+Room.h"
|
|
|
|
|
#import "XCHudTool.h"
|
|
|
|
|
#import "XPHtmlUrl.h"
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#import "Api+Mine.h"
|
2022-03-16 21:33:02 +08:00
|
|
|
|
#import "ClientConfig.h"
|
2022-01-12 18:48:39 +08:00
|
|
|
|
#import "XCCurrentVCStackManager.h"
|
2022-03-28 11:20:28 +08:00
|
|
|
|
#import "XPConstant.h"
|
|
|
|
|
#import "Api+RoomSetting.h"
|
2022-04-13 20:24:26 +08:00
|
|
|
|
#import "RtcManager.h"
|
2022-05-11 20:38:09 +08:00
|
|
|
|
#import "XPRoomMiniManager.h"
|
2022-03-29 16:22:21 +08:00
|
|
|
|
#import "Api+RoomPK.h"
|
2022-06-07 16:16:27 +08:00
|
|
|
|
#import "Api+Room.h"
|
2021-12-15 18:12:55 +08:00
|
|
|
|
///Model
|
|
|
|
|
#import "RoomInfoModel.h"
|
2022-01-06 11:12:32 +08:00
|
|
|
|
#import "MicroQueueModel.h"
|
|
|
|
|
#import "UserInfoModel.h"
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#import "AttachmentModel.h"
|
2022-02-16 15:59:25 +08:00
|
|
|
|
#import "GiftValueInfoModel.h"
|
2022-01-11 20:01:58 +08:00
|
|
|
|
#import "AcrossRoomPKPanelModel.h"
|
2022-03-28 11:20:28 +08:00
|
|
|
|
#import "LittleGameInfoModel.h"
|
2022-04-07 15:02:22 +08:00
|
|
|
|
#import "XPAnchorFansRelationModel.h"
|
2022-04-07 21:13:19 +08:00
|
|
|
|
#import "XPAnchorFansJoinModel.h"
|
|
|
|
|
#import "XPAnchorFansTaskModel.h"
|
2022-04-12 18:16:18 +08:00
|
|
|
|
#import "AcrossRoomPKPanelModel.h"
|
2022-03-29 16:22:21 +08:00
|
|
|
|
#import "RoomPKDetailInfoModel.h"
|
2022-03-29 21:45:17 +08:00
|
|
|
|
#import "RoomPKChooseUserModel.h"
|
2022-03-30 16:27:36 +08:00
|
|
|
|
#import "GiftReceiveInfoModel.h"
|
|
|
|
|
#import "GiftInfoModel.h"
|
|
|
|
|
#import "RoomPKTeamModel.h"
|
2022-06-07 16:16:27 +08:00
|
|
|
|
#import "RoomNewUserGreetModel.h"
|
2021-12-15 18:12:55 +08:00
|
|
|
|
///View
|
2022-01-14 11:38:09 +08:00
|
|
|
|
#import "XPRoomHalfWebView.h"
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#import "XPAnchorAudienceUpMicView.h"
|
|
|
|
|
#import "XPRoomAnchorInfoCardView.h"
|
2022-03-14 19:46:10 +08:00
|
|
|
|
#import "XPRoomTopicViewController.h"
|
2022-03-15 11:16:00 +08:00
|
|
|
|
#import "XPRoomTopicAlertView.h"
|
2022-01-11 14:38:55 +08:00
|
|
|
|
#import "XPAcrossRoomPKInviteView.h"
|
|
|
|
|
#import "XPAcrossRoomPKInviteResultView.h"
|
2022-01-11 20:01:58 +08:00
|
|
|
|
#import "XPAcrpssRoomPKPanelView.h"
|
2022-01-12 17:44:40 +08:00
|
|
|
|
#import "XPAcrossRoomPKResultView.h"
|
|
|
|
|
#import "XPAcrossRoomPKForceEndResultView.h"
|
2022-04-12 18:16:18 +08:00
|
|
|
|
#import "XPAnchorPKInviteView.h"
|
2022-04-13 20:24:26 +08:00
|
|
|
|
#import "XPAnchorPKResultView.h"
|
|
|
|
|
#import "XPAnchorPKFinishView.h"
|
2022-01-12 17:44:40 +08:00
|
|
|
|
#import "XPSendGiftView.h"
|
|
|
|
|
#import "XPUserCardViewController.h"
|
|
|
|
|
#import "XPRoomViewController.h"
|
2022-02-15 14:38:09 +08:00
|
|
|
|
#import "XPLittleGameMiniStageView.h"
|
2022-03-28 11:20:28 +08:00
|
|
|
|
#import "XPLittleGameRoomListView.h"
|
2022-04-13 20:24:26 +08:00
|
|
|
|
#import "AcrossRoomPKPrizeModel.h"
|
2022-04-19 16:45:32 +08:00
|
|
|
|
#import "XPRoomTrumpetView.h"
|
2022-04-20 21:16:32 +08:00
|
|
|
|
#import "XPMineUserInfoViewController.h"
|
2022-04-27 18:05:46 +08:00
|
|
|
|
#import "XPRoomRankEntranceView.h"
|
2022-05-12 20:18:57 +08:00
|
|
|
|
#import "XPRoomAnchorRankEnterView.h"
|
2022-05-09 22:18:42 +08:00
|
|
|
|
#import "XPRoomBackMusicPlayerView.h"
|
2022-06-07 16:16:27 +08:00
|
|
|
|
#import "XPRoomNewUserGreetView.h"
|
|
|
|
|
#import "XPRoomHalfMessageView.h"
|
2022-07-14 18:55:40 +08:00
|
|
|
|
#import "XPAcrossRoomPKCountDownView.h"
|
2022-07-26 16:01:34 +08:00
|
|
|
|
#import "XPNewUserRoomGiftView.h"
|
2022-04-11 19:11:34 +08:00
|
|
|
|
///个播PK
|
2022-04-07 15:02:22 +08:00
|
|
|
|
#import "XPAnchorFansTeamEntranceView.h"
|
|
|
|
|
#import "XPAnchorFansTeamViewController.h"
|
|
|
|
|
#import "XPAnchorFansTaskViewController.h"
|
2022-04-11 19:11:34 +08:00
|
|
|
|
#import "XPAnchorPkPanelView.h"
|
2022-04-07 15:02:22 +08:00
|
|
|
|
#import "XPWebViewController.h"
|
2022-03-28 22:04:09 +08:00
|
|
|
|
#import "XPRoomPKProgressView.h"
|
2022-04-07 15:02:22 +08:00
|
|
|
|
|
2022-06-07 16:16:27 +08:00
|
|
|
|
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate, XPRoomNewUserGreetViewDelegate>
|
2021-12-15 18:12:55 +08:00
|
|
|
|
///host 代理
|
|
|
|
|
@property (nonatomic,weak) id<RoomHostDelegate>delegate;
|
|
|
|
|
///房间榜
|
2022-04-27 18:05:46 +08:00
|
|
|
|
@property (nonatomic,strong) XPRoomRankEntranceView *contributeEnterView;
|
2022-01-06 11:12:32 +08:00
|
|
|
|
///相亲阶段的按钮
|
|
|
|
|
@property (nonatomic,strong) UIButton *datingProgresButton;
|
2022-02-15 17:23:18 +08:00
|
|
|
|
///关注个播房主倒计时
|
|
|
|
|
@property (nonatomic, strong) dispatch_source_t followAnchorTimer;
|
2022-04-07 15:02:22 +08:00
|
|
|
|
///个播粉丝团入口
|
|
|
|
|
@property (nonatomic, strong) XPAnchorFansTeamEntranceView *fansTeamEntranceView;
|
2022-04-18 20:53:40 +08:00
|
|
|
|
///个播小时榜入口按钮
|
2022-05-12 20:18:57 +08:00
|
|
|
|
@property (nonatomic, strong) XPRoomAnchorRankEnterView *hourRankEntranceView;
|
2022-03-14 19:46:10 +08:00
|
|
|
|
///话题的容器
|
|
|
|
|
@property (nonatomic,strong) UIStackView *topicStackView;
|
|
|
|
|
///话题
|
|
|
|
|
@property (nonatomic,strong) UILabel *topicLabel;
|
|
|
|
|
///编辑
|
|
|
|
|
@property (nonatomic,strong) UIButton *editButton;
|
2022-01-11 20:01:58 +08:00
|
|
|
|
///跨房pk的面板
|
|
|
|
|
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
|
2022-07-14 18:55:40 +08:00
|
|
|
|
///跨房PK预约倒计时
|
|
|
|
|
@property (nonatomic, strong) XPAcrossRoomPKCountDownView *acrossPKCountView;
|
2022-02-15 14:38:09 +08:00
|
|
|
|
///小游戏 最小化的坑位
|
|
|
|
|
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
|
2022-03-28 11:20:28 +08:00
|
|
|
|
///显示游戏的切换
|
|
|
|
|
@property (nonatomic,strong) XPLittleGameRoomListView *gameListView;
|
2022-04-11 19:11:34 +08:00
|
|
|
|
///粉丝团数据
|
2022-04-07 21:13:19 +08:00
|
|
|
|
@property (nonatomic, strong) XPAnchorFansRelationModel *relationFansModel;
|
2022-04-11 19:11:34 +08:00
|
|
|
|
///个播PK面板
|
|
|
|
|
@property (nonatomic, strong) XPAnchorPkPanelView *anchorPKPanelView;
|
2022-04-19 16:45:32 +08:00
|
|
|
|
///小喇叭
|
|
|
|
|
@property (nonatomic, strong) XPRoomTrumpetView *trumpetView;
|
|
|
|
|
///小喇叭队列
|
|
|
|
|
@property (nonatomic, strong) NSMutableArray *trumpetQueue;
|
|
|
|
|
///小喇叭动画定时器
|
|
|
|
|
@property (nonatomic, strong) dispatch_source_t trumpetTimer;
|
2022-05-09 22:18:42 +08:00
|
|
|
|
///播放器的入口
|
|
|
|
|
@property (nonatomic,strong) UIButton *musicEnterButton;
|
|
|
|
|
///播放器
|
|
|
|
|
@property (nonatomic,strong) XPRoomBackMusicPlayerView *musicPlayView;
|
2022-03-28 22:04:09 +08:00
|
|
|
|
///房间PKview
|
|
|
|
|
@property (nonatomic,strong) XPRoomPKProgressView *roompkPanelView;
|
2022-03-30 21:59:49 +08:00
|
|
|
|
///pk详情
|
2022-03-29 16:22:21 +08:00
|
|
|
|
@property (nonatomic,strong) RoomPKDetailInfoModel *pkDetailInfo;
|
2022-06-13 16:19:40 +08:00
|
|
|
|
///是否正在加载打招呼
|
|
|
|
|
@property (nonatomic,assign) BOOL isLoadGreet;
|
2022-07-26 16:01:34 +08:00
|
|
|
|
///获取新用户礼物倒计时3s
|
|
|
|
|
@property (nonatomic, strong) dispatch_source_t userGiftTimer;
|
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
@end
|
|
|
|
|
|
|
|
|
|
@implementation XPRoomFunctionContainerView
|
2022-03-10 15:37:56 +08:00
|
|
|
|
|
|
|
|
|
- (void)dealloc {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (self.followAnchorTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.followAnchorTimer);
|
|
|
|
|
}
|
2022-04-19 16:45:32 +08:00
|
|
|
|
if (self.trumpetTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.trumpetTimer);
|
|
|
|
|
}
|
2022-07-26 16:01:34 +08:00
|
|
|
|
if (self.userGiftTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.userGiftTimer);
|
|
|
|
|
}
|
2022-03-10 15:37:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
|
|
|
|
|
self = [super init];
|
|
|
|
|
if (self) {
|
|
|
|
|
self.delegate = delegate;
|
|
|
|
|
[self initSubViews];
|
|
|
|
|
[self initSubViewConstraints];
|
|
|
|
|
}
|
|
|
|
|
return self;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 18:39:36 +08:00
|
|
|
|
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
|
|
|
|
for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) {
|
|
|
|
|
UIView * subView = [self.subviews objectAtIndex:i];
|
|
|
|
|
CGPoint convertPoint = [subView convertPoint:point fromView:self];
|
|
|
|
|
if (CGRectContainsPoint(subView.bounds, convertPoint)) {
|
|
|
|
|
return [subView hitTest:convertPoint withEvent:event];
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-09 22:18:42 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (NSInteger i = (self.subviews.count - 1) ; i >= 0 ; i--) {
|
|
|
|
|
UIView * subView = [self.subviews objectAtIndex:i];
|
|
|
|
|
if (self.musicPlayView.superview && self.musicEnterButton.hidden == YES && ![subView isEqual:self.musicPlayView]) {
|
|
|
|
|
[UIView animateWithDuration:0.2 animations:^{
|
|
|
|
|
self.musicEnterButton.hidden = NO;
|
|
|
|
|
} completion:nil];
|
|
|
|
|
|
|
|
|
|
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
|
|
|
|
moveAnimation.fromValue = [NSValue valueWithCGPoint:self.musicPlayView.center];
|
|
|
|
|
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, self.musicPlayView.center.y)];
|
|
|
|
|
moveAnimation.beginTime = CACurrentMediaTime();
|
|
|
|
|
moveAnimation.duration = 0.5;
|
|
|
|
|
moveAnimation.repeatCount = 1;
|
|
|
|
|
moveAnimation.removedOnCompletion = YES;
|
|
|
|
|
[self.musicPlayView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-28 18:39:36 +08:00
|
|
|
|
return nil;
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 14:38:09 +08:00
|
|
|
|
#pragma mark - Public Method
|
|
|
|
|
- (void)hiddenSudGamePostionView {
|
2022-05-13 18:41:52 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.mgMicNum > 6) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-02-15 14:38:09 +08:00
|
|
|
|
[self.littleGameMiniView hiddenSudGamePostionView];
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 20:38:09 +08:00
|
|
|
|
- (Music *)getCurrentMusic {
|
|
|
|
|
return self.musicPlayView.currentMusic;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-12 20:09:41 +08:00
|
|
|
|
- (BOOL)isPlaying {
|
|
|
|
|
return self.musicPlayView.isPlaying;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-27 18:24:13 +08:00
|
|
|
|
|
|
|
|
|
- (NSArray *)getRoomPKGroupTeamList {
|
|
|
|
|
NSArray * redArray = @[];
|
|
|
|
|
if (self.roompkPanelView.redChooseArray > 0) {
|
|
|
|
|
redArray = self.roompkPanelView.redChooseArray;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NSArray * blueArray = @[];
|
|
|
|
|
if (self.roompkPanelView.blueChooseArray > 0) {
|
|
|
|
|
blueArray = self.roompkPanelView.blueChooseArray;
|
|
|
|
|
}
|
|
|
|
|
return @[redArray, blueArray];
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-29 14:31:00 +08:00
|
|
|
|
///房间内PK是否正在进行
|
|
|
|
|
- (BOOL)isRoomPKPlaying {
|
|
|
|
|
return [self.roompkPanelView isRoomPKPlaying];
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
#pragma mark - Private Method
|
|
|
|
|
- (void)initSubViews {
|
2022-04-27 18:05:46 +08:00
|
|
|
|
[self addSubview:self.contributeEnterView];
|
2022-03-14 19:46:10 +08:00
|
|
|
|
[self addSubview:self.topicStackView];
|
|
|
|
|
[self.topicStackView addArrangedSubview:self.topicLabel];
|
|
|
|
|
[self.topicStackView addArrangedSubview:self.editButton];
|
2021-12-15 18:12:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)initSubViewConstraints {
|
2022-04-27 18:05:46 +08:00
|
|
|
|
[self.contributeEnterView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.left.mas_equalTo(0);
|
|
|
|
|
make.top.mas_equalTo(kNavigationHeight+4);
|
|
|
|
|
make.width.mas_equalTo(116);
|
|
|
|
|
make.height.mas_equalTo(22);
|
2021-12-15 18:12:55 +08:00
|
|
|
|
}];
|
2022-05-11 20:38:09 +08:00
|
|
|
|
|
2022-03-14 19:46:10 +08:00
|
|
|
|
[self.topicStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.height.mas_equalTo(15);
|
|
|
|
|
make.top.mas_equalTo(58 + 5 + 6 + 12 + 3 + kNavigationHeight);
|
|
|
|
|
}];
|
2021-12-15 18:12:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-05 19:03:22 +08:00
|
|
|
|
- (void)showLittleGameMiniView:(RoomType)type micCount:(NSInteger)micCount {
|
2022-03-24 16:25:16 +08:00
|
|
|
|
if (type == RoomType_MiniGame) {
|
|
|
|
|
if (!self.littleGameMiniView.superview) {
|
|
|
|
|
[self addSubview:self.littleGameMiniView];
|
|
|
|
|
[self.littleGameMiniView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(0);
|
|
|
|
|
make.top.mas_equalTo(kNavigationHeight);
|
|
|
|
|
make.height.mas_equalTo(23);
|
|
|
|
|
}];
|
|
|
|
|
}
|
2022-05-05 19:03:22 +08:00
|
|
|
|
self.littleGameMiniView.micCount = micCount;
|
2022-05-13 18:41:52 +08:00
|
|
|
|
if (micCount > 6) {
|
|
|
|
|
[self.littleGameMiniView removeFromSuperview];
|
|
|
|
|
}
|
2022-03-24 16:25:16 +08:00
|
|
|
|
} else {
|
|
|
|
|
if (self.littleGameMiniView.superview) {
|
|
|
|
|
[self.littleGameMiniView removeFromSuperview];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 11:20:28 +08:00
|
|
|
|
- (void)configLittleGameState {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
if (roomInfo.isPermitRoom != PermitRoomType_Licnese && roomInfo.roomModeType != RoomModeType_Open_Blind && roomInfo.roomModeType != RoomModeType_Open_PK_Mode && roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode && roomInfo.roomModeType != RoomModeType_Open_Micro_Mode && !roomInfo.leaveMode && roomInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
if (!self.gameListView.superview) {
|
|
|
|
|
[self addSubview:self.gameListView];
|
|
|
|
|
[self.gameListView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-03-30 20:26:16 +08:00
|
|
|
|
make.right.mas_equalTo(self).offset(-85);
|
2022-05-05 15:43:51 +08:00
|
|
|
|
make.top.mas_equalTo(self).offset(kNavigationHeight - 14 - 11 - 19.0 / 2.0);
|
2022-03-28 11:20:28 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
2022-04-01 23:41:44 +08:00
|
|
|
|
self.gameListView.mgId = roomInfo.mgId > 0 ? [NSString stringWithFormat:@"%lld", roomInfo.mgId] : @"0";
|
2022-03-28 11:20:28 +08:00
|
|
|
|
} else {
|
|
|
|
|
if (self.gameListView.superview) {
|
|
|
|
|
[self.gameListView removeFromSuperview];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//自己是否在游戏中
|
|
|
|
|
- (BOOL)isInSudGame {
|
|
|
|
|
BOOL isGamePlaying = NO;
|
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
|
|
|
|
for (int i = -1; i<5; i++) {
|
|
|
|
|
NSMutableDictionary * micQueue = self.delegate.getMicroQueue;
|
|
|
|
|
MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]];
|
|
|
|
|
if (micSequence == nil || micSequence.userInfo == nil) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (micSequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) {
|
|
|
|
|
isGamePlaying = YES;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return isGamePlaying;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-30 17:41:34 +08:00
|
|
|
|
///当前房间是否在游戏中
|
|
|
|
|
- (BOOL)currentRoomIsInSudGame {
|
|
|
|
|
BOOL isGamePlaying = NO;
|
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
|
|
|
|
for (int i = -1; i<5; i++) {
|
|
|
|
|
NSMutableDictionary * micQueue = self.delegate.getMicroQueue;
|
|
|
|
|
MicroQueueModel *micSequence = [micQueue objectForKey:[NSString stringWithFormat:@"%d", i]];
|
|
|
|
|
if (micSequence == nil || micSequence.userInfo == nil) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
if (micSequence.userInfo.gameStatus == LittleGamePlayStatus_Plying) {
|
|
|
|
|
isGamePlaying = YES;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return isGamePlaying;
|
|
|
|
|
}
|
|
|
|
|
|
2022-06-07 16:16:27 +08:00
|
|
|
|
#pragma mark - 新用户打招呼动画
|
|
|
|
|
- (void)handleNewUserGreet {
|
2022-06-13 16:19:40 +08:00
|
|
|
|
if (self.delegate.getUserInfo.fromType == UserEnterRoomFromType_New_User_Greet && !self.isLoadGreet) {
|
|
|
|
|
self.isLoadGreet = YES;
|
2022-06-07 16:16:27 +08:00
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
|
|
|
|
[Api newUserStartGreet:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
RoomNewUserGreetModel * info = [RoomNewUserGreetModel modelWithDictionary:data.data];
|
|
|
|
|
if (info.roomPopup) {
|
|
|
|
|
XPRoomNewUserGreetView * greetView = [[XPRoomNewUserGreetView alloc] initWithFrame:CGRectMake(KScreenWidth, kSafeAreaTopHeight + 52, KScreenWidth, 80)];
|
|
|
|
|
greetView.delegate = self;
|
|
|
|
|
greetView.sayHelloUserAvatarList = info.sayHelloUserAvatarList;
|
|
|
|
|
[self addSubview:greetView];
|
|
|
|
|
[UIView animateWithDuration:.35 animations:^{
|
|
|
|
|
CGRect rect = greetView.frame;
|
|
|
|
|
rect.origin.x = 0;
|
|
|
|
|
greetView.frame = rect;
|
|
|
|
|
} completion:nil];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} roomUid:roomUid];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)xPRoomNewUserGreetView:(XPRoomNewUserGreetView *)view didClickCheckout:(UIButton *)sender {
|
|
|
|
|
XPRoomHalfMessageView *halfMessageView = [[XPRoomHalfMessageView alloc] initWithFrame:CGRectMake(0, KScreenHeight, KScreenWidth, KScreenHeight)];
|
|
|
|
|
[self addSubview:halfMessageView];
|
|
|
|
|
[UIView animateWithDuration:.35 animations:^{
|
|
|
|
|
CGRect rect = halfMessageView.frame;
|
|
|
|
|
rect.origin.y = 0;
|
|
|
|
|
halfMessageView.frame = rect;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-26 16:01:34 +08:00
|
|
|
|
#pragma mark - 新用户房间礼物
|
|
|
|
|
- (void)handleNewUserRoomGift {
|
|
|
|
|
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
BOOL hadShow = [defaults boolForKey:kHadShowNewUserGiftKey];
|
2022-07-29 17:35:03 +08:00
|
|
|
|
if (!hadShow && self.delegate.getUserInfo.uid != self.delegate.getRoomInfo.uid) {
|
2022-07-26 16:01:34 +08:00
|
|
|
|
if (self.userGiftTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.userGiftTimer);
|
|
|
|
|
}
|
|
|
|
|
NSInteger totalTime = 3;
|
|
|
|
|
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
|
|
|
|
self.userGiftTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
|
|
|
|
dispatch_source_set_timer(self.userGiftTimer,dispatch_walltime(NULL, totalTime*NSEC_PER_SEC), totalTime*NSEC_PER_SEC, 0); //每秒执行
|
|
|
|
|
@weakify(self);
|
|
|
|
|
dispatch_source_set_event_handler(self.userGiftTimer, ^{
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
@strongify(self);
|
|
|
|
|
if (self.userGiftTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.userGiftTimer);
|
|
|
|
|
self.userGiftTimer = nil;
|
|
|
|
|
}
|
|
|
|
|
[Api requestNewUserInRoomGift:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
2022-07-29 17:35:03 +08:00
|
|
|
|
if (code == 200) {
|
|
|
|
|
if (data.data != nil) {
|
|
|
|
|
GiftInfoModel *giftInfo = [GiftInfoModel modelWithJSON:data.data];
|
|
|
|
|
XPNewUserRoomGiftView *view = [[XPNewUserRoomGiftView alloc] init];
|
|
|
|
|
view.giftInfo = giftInfo;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleAlert];
|
|
|
|
|
}
|
2022-07-26 16:01:34 +08:00
|
|
|
|
[defaults setBool:YES forKey:kHadShowNewUserGiftKey];
|
|
|
|
|
[defaults synchronize];
|
|
|
|
|
}
|
|
|
|
|
} roomUid:[NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid]];
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
dispatch_resume(self.userGiftTimer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-29 16:22:21 +08:00
|
|
|
|
#pragma mark - 房间PK
|
2022-03-30 21:59:49 +08:00
|
|
|
|
- (void)configRoomPKPanelView:(BOOL)isEnter {
|
2022-03-28 22:04:09 +08:00
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
2022-05-29 14:59:32 +08:00
|
|
|
|
self.roompkPanelView.roomInfo = roomInfo;
|
2022-03-28 22:04:09 +08:00
|
|
|
|
if (!self.roompkPanelView.superview) {
|
|
|
|
|
[self addSubview:self.roompkPanelView];
|
|
|
|
|
[self.roompkPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.left.mas_equalTo(self).offset(15);
|
2022-05-19 11:08:59 +08:00
|
|
|
|
make.top.mas_equalTo(self).offset(35 + (58 + 5 + 6 + 12) + 38 + (55 + 10 + 12 + 5+16) * 2 + 15 * 2 + kNavigationHeight + 5);
|
2022-03-28 22:04:09 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
2022-05-31 17:31:13 +08:00
|
|
|
|
NSString * roomId = [NSString stringWithFormat:@"%ld", roomInfo.roomId];
|
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = roomId;
|
|
|
|
|
request.userIds = @[uid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = members.firstObject;
|
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
|
|
|
|
|
self.roompkPanelView.isManager = YES;
|
|
|
|
|
}else {
|
|
|
|
|
self.roompkPanelView.isManager = NO;
|
2022-03-29 16:22:21 +08:00
|
|
|
|
}
|
2022-06-01 17:39:33 +08:00
|
|
|
|
|
|
|
|
|
if (isEnter) {
|
|
|
|
|
[self.roompkPanelView enterRoomGetRoomPKDetailInfo];
|
|
|
|
|
}
|
2022-05-31 17:31:13 +08:00
|
|
|
|
}
|
|
|
|
|
}];
|
2022-03-28 22:04:09 +08:00
|
|
|
|
} else {
|
|
|
|
|
if (self.roompkPanelView.superview) {
|
|
|
|
|
[self.roompkPanelView removeFromSuperview];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-06 11:12:32 +08:00
|
|
|
|
#pragma mark - RoomGuestDelegate
|
|
|
|
|
- (void)onRoomUpdate {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
MicroQueueModel * model = [self.delegate.getMicroQueue objectForKey:@"-1"];
|
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_Blind && model.userInfo && model.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
if (!self.datingProgresButton.superview) {
|
|
|
|
|
[self addSubview:self.datingProgresButton];
|
|
|
|
|
[self.datingProgresButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(70, 30));
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-05-07 17:04:57 +08:00
|
|
|
|
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight + 35);
|
2022-01-06 11:12:32 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch (roomInfo.blindDateState) {
|
|
|
|
|
case RoomPlayDateingType_Talk:
|
|
|
|
|
[self.datingProgresButton setTitle:@"开始选择>" forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
case RoomPlayDateingType_Pick:
|
|
|
|
|
[self.datingProgresButton setTitle:@"公布心动>" forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
case RoomPlayDateingType_Result:
|
|
|
|
|
[self.datingProgresButton setTitle:@"结束本轮>" forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
case RoomPlayDateingType_Finish:
|
|
|
|
|
[self.datingProgresButton setTitle:@"嘉宾交流>" forState:UIControlStateNormal];
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (self.datingProgresButton.superview) {
|
|
|
|
|
[self.datingProgresButton removeFromSuperview];
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-06-07 17:51:32 +08:00
|
|
|
|
[self updateHourRankEntrance];
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (roomInfo.type == RoomType_Anchor) {
|
2022-04-27 18:05:46 +08:00
|
|
|
|
self.contributeEnterView.title = @"主播榜";
|
2022-04-07 15:02:22 +08:00
|
|
|
|
if (roomInfo.hadChangeRoomType) {
|
2022-04-29 16:56:53 +08:00
|
|
|
|
///切换房间类型初始化当前用户与房间粉丝团关系
|
2022-04-07 15:02:22 +08:00
|
|
|
|
[Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
|
|
|
|
|
[self updateFansTeamEntranceView:model];
|
|
|
|
|
} teamUid:[NSString stringWithFormat:@"%ld", roomInfo.uid]];
|
2022-04-29 16:56:53 +08:00
|
|
|
|
[self updateContrionEntranceWithRoomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid] type:@"month"];
|
2022-04-07 15:02:22 +08:00
|
|
|
|
}
|
2022-01-11 14:38:55 +08:00
|
|
|
|
} else {
|
2022-04-27 18:05:46 +08:00
|
|
|
|
self.contributeEnterView.title = @"房间榜";
|
2022-05-13 16:11:24 +08:00
|
|
|
|
[self.fansTeamEntranceView removeFromSuperview];
|
2022-04-29 16:56:53 +08:00
|
|
|
|
if (roomInfo.hadChangeRoomType) {
|
|
|
|
|
[self updateContrionEntranceWithRoomUid:[NSString stringWithFormat:@"%ld", roomInfo.uid] type:@"day"];
|
|
|
|
|
}
|
2022-01-11 14:38:55 +08:00
|
|
|
|
}
|
2022-03-14 19:46:10 +08:00
|
|
|
|
[self updateRoomTopic];
|
2022-05-05 19:03:22 +08:00
|
|
|
|
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
|
2022-03-28 11:20:28 +08:00
|
|
|
|
[self configLittleGameState];
|
2022-05-12 20:25:46 +08:00
|
|
|
|
[self configPlayMusicRoomTypeChange];
|
2022-03-30 21:59:49 +08:00
|
|
|
|
[self configRoomPKPanelView:NO];
|
2022-01-06 11:12:32 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 17:23:18 +08:00
|
|
|
|
- (void)onRoomEntered {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", roomInfo.uid];
|
2022-06-07 17:51:32 +08:00
|
|
|
|
[self updateHourRankEntrance];
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (roomInfo.type == RoomType_Anchor) {//个播房
|
2022-04-29 16:56:53 +08:00
|
|
|
|
self.contributeEnterView.title = @"主播榜";
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (![[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {//非房主
|
|
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
|
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//是否关注了个播房主
|
|
|
|
|
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
|
|
|
|
if (!isLike) {
|
|
|
|
|
[self setFollowAnchorTimer];
|
|
|
|
|
}
|
|
|
|
|
} uid:uid isLikeUid:roomUid];
|
2022-04-07 15:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
///进房初始化当前用户与房间粉丝团关系
|
|
|
|
|
[Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
|
|
|
|
|
[self updateFansTeamEntranceView:model];
|
|
|
|
|
} teamUid:roomUid];
|
2022-04-29 16:56:53 +08:00
|
|
|
|
[self updateContrionEntranceWithRoomUid:roomUid type:@"month"];//获取房间榜前三名
|
|
|
|
|
} else {
|
|
|
|
|
self.contributeEnterView.title = @"房间榜";
|
|
|
|
|
[self updateContrionEntranceWithRoomUid:roomUid type:@"day"];//获取房间榜前三名
|
|
|
|
|
}
|
2022-01-11 20:01:58 +08:00
|
|
|
|
|
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
|
|
|
|
[Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code == 200) {
|
2022-04-12 18:16:18 +08:00
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
|
2022-04-18 18:12:57 +08:00
|
|
|
|
[self updateAnchorPkInfo:acrossPKPanelInfo];
|
2022-04-12 18:16:18 +08:00
|
|
|
|
if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) {
|
|
|
|
|
if (acrossPKPanelInfo.aUid.integerValue > 0) {
|
|
|
|
|
if (!self.anchorPKPanelView.superview) {
|
|
|
|
|
[self addSubview:self.anchorPKPanelView];
|
|
|
|
|
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-04-15 18:32:20 +08:00
|
|
|
|
make.top.mas_equalTo(kNavigationHeight + 87);
|
2022-04-12 18:16:18 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
|
|
|
|
|
if (acrossPKPanelInfo.aUid.integerValue > 0) {
|
|
|
|
|
if (!self.acrossPKPanelView.superview) {
|
|
|
|
|
[self addSubview:self.acrossPKPanelView];
|
|
|
|
|
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-11 20:01:58 +08:00
|
|
|
|
} else {
|
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
|
}
|
|
|
|
|
} roomUid:roomUid];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
2022-07-14 18:55:40 +08:00
|
|
|
|
if (roomInfo.showPkBeginTime && roomInfo.roomModeType != RoomModeType_Open_AcrossRoomPK_mode) {//显示PK倒计时
|
|
|
|
|
if (!self.acrossPKCountView.superview) {
|
|
|
|
|
[self addSubview:self.acrossPKCountView];
|
|
|
|
|
self.acrossPKCountView.startTime = roomInfo.pkBeginTime;
|
|
|
|
|
[self.acrossPKCountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.left.mas_equalTo(0);
|
|
|
|
|
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(4);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(130, 34));
|
|
|
|
|
}];
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
CGRect frame = self.acrossPKCountView.frame;
|
|
|
|
|
frame.origin.x = 0;
|
|
|
|
|
self.acrossPKCountView.frame = frame;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-14 19:46:10 +08:00
|
|
|
|
[self updateRoomTopic];
|
2022-05-05 19:03:22 +08:00
|
|
|
|
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
|
2022-03-28 11:20:28 +08:00
|
|
|
|
[self configLittleGameState];
|
2022-03-30 21:59:49 +08:00
|
|
|
|
[self configRoomPKPanelView:YES];
|
2022-06-07 16:16:27 +08:00
|
|
|
|
[self handleNewUserGreet];
|
2022-07-26 16:01:34 +08:00
|
|
|
|
///新用户房间礼物
|
|
|
|
|
[self handleNewUserRoomGift];
|
2022-05-11 20:38:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)onRoomMiniEntered {
|
|
|
|
|
if ([XPRoomMiniManager shareManager].getCurrentMusic) {
|
|
|
|
|
if (!self.musicPlayView.superview) {
|
|
|
|
|
[self addSubview:self.musicPlayView];
|
|
|
|
|
self.musicPlayView.frame = CGRectMake(-KScreenWidth, kNavigationHeight + 4, KScreenWidth - 85, 80);
|
|
|
|
|
}
|
2022-05-12 20:09:41 +08:00
|
|
|
|
[self.musicPlayView configCurrentPlayingMusic:[XPRoomMiniManager shareManager].getCurrentMusic isPlaying:[XPRoomMiniManager shareManager].musicPlaying];
|
|
|
|
|
[[XPRoomMiniManager shareManager] configCurrentMusic:nil isPlaying:NO];
|
2022-05-11 20:38:09 +08:00
|
|
|
|
}
|
2022-03-04 15:48:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 17:23:18 +08:00
|
|
|
|
- (void)handleNIMCustomMessage:(NIMMessage *)message {
|
2022-03-30 21:59:49 +08:00
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
2022-02-15 17:23:18 +08:00
|
|
|
|
NIMCustomObject *obj = (NIMCustomObject *)message.messageObject;
|
|
|
|
|
if (obj.attachment != nil && [obj.attachment isKindOfClass:[AttachmentModel class]]) {
|
|
|
|
|
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) {
|
|
|
|
|
[self showAskForUpMic:attachment.data];
|
2022-03-30 16:27:36 +08:00
|
|
|
|
} else if(attachment.first == CustomMessageType_Gift && (attachment.second == Custom_Message_Sub_Gift_Send || attachment.second == Custom_Message_Sub_Gift_LuckySend || attachment.second == Custom_Message_Sub_Gift_ChannelNotify)) {
|
2022-03-30 21:59:49 +08:00
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
|
|
|
[self.roompkPanelView roomPKReceiveGift:attachment];
|
|
|
|
|
}
|
2022-03-30 16:27:36 +08:00
|
|
|
|
}else if(attachment.first == CustomMessageType_AllMicroSend && (attachment.second == Custom_Message_Sub_AllMicroSend || attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend)) {
|
2022-03-30 21:59:49 +08:00
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
|
|
|
[self.roompkPanelView roomPKReceiveGift:attachment];
|
2022-03-29 21:45:17 +08:00
|
|
|
|
}
|
2022-03-30 21:59:49 +08:00
|
|
|
|
} else if(attachment.first == CustomMessageType_Room_PK) {
|
|
|
|
|
[self.roompkPanelView handleRoomPKCustomMessage:attachment];
|
2022-01-11 14:38:55 +08:00
|
|
|
|
} else if (attachment.first == CustomMessageType_Across_Room_PK) {
|
2022-04-18 22:36:16 +08:00
|
|
|
|
///自己是公会超管
|
|
|
|
|
BOOL meIsSuperAdmin = NO;
|
|
|
|
|
for (GuildSuperAdminInfoModel *managerInfo in self.delegate.getRoomSuperAdminList) {
|
|
|
|
|
if ([managerInfo.uid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
|
|
|
|
meIsSuperAdmin = YES;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-11 14:38:55 +08:00
|
|
|
|
switch (attachment.second) {
|
|
|
|
|
case Custom_Message_Sub_AcrossRoomPK_Invite:
|
|
|
|
|
{
|
2022-07-14 18:55:40 +08:00
|
|
|
|
[self.acrossPKCountView removeFromSuperview];
|
|
|
|
|
self.acrossPKCountView = nil;
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
2022-04-18 22:36:16 +08:00
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || meIsSuperAdmin) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
XPAcrossRoomPKInviteView * inviteView = [[XPAcrossRoomPKInviteView alloc] init];
|
|
|
|
|
inviteView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
|
|
|
|
inviteView.dataDic = attachment.data;
|
|
|
|
|
[self addSubview:inviteView];
|
|
|
|
|
[inviteView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.center.mas_equalTo(self);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Custom_Message_Sub_AcrossRoomPK_Accept:
|
|
|
|
|
{
|
2022-07-14 18:55:40 +08:00
|
|
|
|
[self.acrossPKCountView removeFromSuperview];
|
|
|
|
|
self.acrossPKCountView = nil;
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
2022-04-18 22:36:16 +08:00
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || meIsSuperAdmin) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
|
|
|
|
inviteResutView.isAccept = YES;
|
|
|
|
|
[self addSubview:inviteResutView];
|
|
|
|
|
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(281, 42));
|
|
|
|
|
}];
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[inviteResutView removeFromSuperview];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Custom_Message_Sub_AcrossRoomPK_Reject:
|
|
|
|
|
{
|
2022-07-14 18:55:40 +08:00
|
|
|
|
[self.acrossPKCountView removeFromSuperview];
|
|
|
|
|
self.acrossPKCountView = nil;
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
2022-04-18 22:36:16 +08:00
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || meIsSuperAdmin) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
|
|
|
|
inviteResutView.isAccept = NO;
|
|
|
|
|
[self addSubview:inviteResutView];
|
|
|
|
|
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-01-11 14:57:09 +08:00
|
|
|
|
make.size.mas_equalTo(CGSizeMake(201, 42));
|
2022-01-11 14:38:55 +08:00
|
|
|
|
}];
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[inviteResutView removeFromSuperview];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-01-11 20:01:58 +08:00
|
|
|
|
case Custom_Message_Sub_AcrossRoomPK_Panel:
|
|
|
|
|
{
|
2022-07-14 18:55:40 +08:00
|
|
|
|
[self.acrossPKCountView removeFromSuperview];
|
|
|
|
|
self.acrossPKCountView = nil;
|
2022-01-11 20:01:58 +08:00
|
|
|
|
if (!self.acrossPKPanelView.superview) {
|
|
|
|
|
[self addSubview:self.acrossPKPanelView];
|
|
|
|
|
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-01-12 18:48:39 +08:00
|
|
|
|
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-01-11 20:01:58 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
|
|
|
|
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Custom_Message_Sub_AcrossRoomPK_End:
|
|
|
|
|
{
|
2022-07-14 18:55:40 +08:00
|
|
|
|
[self.acrossPKCountView removeFromSuperview];
|
|
|
|
|
self.acrossPKCountView = nil;
|
2022-01-12 17:44:40 +08:00
|
|
|
|
[self.acrossPKPanelView resetAcrossPKViewData];
|
|
|
|
|
[self.acrossPKPanelView removeFromSuperview];
|
|
|
|
|
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
|
|
|
|
if (model.isForce) {
|
|
|
|
|
XPAcrossRoomPKForceEndResultView *view = [[XPAcrossRoomPKForceEndResultView alloc] initWithFrame:CGRectMake(0, 0, 281, 208)];
|
|
|
|
|
view.data = model;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleAlert];
|
|
|
|
|
} else {
|
|
|
|
|
XPAcrossRoomPKResultView *view = [[XPAcrossRoomPKResultView alloc] initWithFrame:CGRectMake(0, 0, 320, 453)];
|
|
|
|
|
view.data = model;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleAlert];
|
|
|
|
|
}
|
2022-01-11 20:01:58 +08:00
|
|
|
|
}
|
2022-04-11 19:11:34 +08:00
|
|
|
|
break;
|
2022-04-12 18:16:18 +08:00
|
|
|
|
///个播跨房PK
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_Invite://收到个播PK邀请
|
2022-04-11 19:11:34 +08:00
|
|
|
|
{
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
|
|
|
|
if (member.type == NIMTeamMemberTypeOwner) {
|
2022-04-12 18:16:18 +08:00
|
|
|
|
XPAnchorPKInviteView * inviteView = [[XPAnchorPKInviteView alloc] init];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
inviteView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
|
|
|
|
inviteView.dataDic = attachment.data;
|
2022-04-19 21:14:50 +08:00
|
|
|
|
[TTPopup popupView:inviteView style:TTPopupStyleAlert];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_Accept://对方接受个播PK邀请
|
2022-04-11 19:11:34 +08:00
|
|
|
|
{
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
|
|
|
|
if (member.type == NIMTeamMemberTypeOwner) {
|
|
|
|
|
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
|
|
|
|
inviteResutView.isAccept = YES;
|
|
|
|
|
[self addSubview:inviteResutView];
|
|
|
|
|
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(281, 42));
|
|
|
|
|
}];
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[inviteResutView removeFromSuperview];
|
|
|
|
|
});
|
2022-04-14 19:34:48 +08:00
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
|
|
|
|
[[RtcManager instance] connectOtherRoom:acrossPKPanelInfo.aRoomId userId:acrossPKPanelInfo.aUid];
|
2022-04-18 18:12:57 +08:00
|
|
|
|
[self updateAnchorPkInfo:acrossPKPanelInfo];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_Reject://对方拒绝个播PK邀请
|
2022-04-11 19:11:34 +08:00
|
|
|
|
{
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error == nil) {
|
|
|
|
|
NIMChatroomMember * member = [members firstObject];
|
|
|
|
|
if (member.type == NIMTeamMemberTypeOwner) {
|
|
|
|
|
XPAcrossRoomPKInviteResultView * inviteResutView = [[XPAcrossRoomPKInviteResultView alloc] init];
|
|
|
|
|
inviteResutView.isAccept = NO;
|
|
|
|
|
[self addSubview:inviteResutView];
|
|
|
|
|
[inviteResutView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self).offset(114 + kSafeAreaTopHeight);
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
|
|
|
|
make.size.mas_equalTo(CGSizeMake(201, 42));
|
|
|
|
|
}];
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[inviteResutView removeFromSuperview];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
break;
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_Panel://个播PK面板消息
|
2022-04-11 19:11:34 +08:00
|
|
|
|
{
|
2022-04-12 18:16:18 +08:00
|
|
|
|
if (!self.anchorPKPanelView.superview) {
|
|
|
|
|
[self addSubview:self.anchorPKPanelView];
|
|
|
|
|
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
2022-04-11 19:11:34 +08:00
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-04-15 18:32:20 +08:00
|
|
|
|
make.top.mas_equalTo(kNavigationHeight + 87);
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
2022-04-12 18:16:18 +08:00
|
|
|
|
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
|
2022-04-18 18:12:57 +08:00
|
|
|
|
[self updateAnchorPkInfo:acrossPKPanelInfo];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_End://个播PK结束,进入惩罚阶段
|
2022-04-11 19:11:34 +08:00
|
|
|
|
{
|
2022-04-12 18:16:18 +08:00
|
|
|
|
if (!self.anchorPKPanelView.superview) {
|
|
|
|
|
[self addSubview:self.anchorPKPanelView];
|
|
|
|
|
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.centerX.mas_equalTo(self);
|
2022-04-15 18:32:20 +08:00
|
|
|
|
make.top.mas_equalTo(kNavigationHeight + 87);
|
2022-04-12 18:16:18 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
|
|
|
|
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
|
2022-04-18 18:12:57 +08:00
|
|
|
|
[self updateAnchorPkInfo:acrossPKPanelInfo];
|
|
|
|
|
if (acrossPKPanelInfo.isForce) {
|
|
|
|
|
XPAnchorPKFinishView *view = [[XPAnchorPKFinishView alloc] init];
|
|
|
|
|
view.data = acrossPKPanelInfo;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleAlert];
|
|
|
|
|
} else {
|
|
|
|
|
XPAnchorPKResultView *view = [[XPAnchorPKResultView alloc] initWithFrame:CGRectMake(0, 0, 300, 472)];
|
|
|
|
|
view.data = acrossPKPanelInfo;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleAlert];
|
|
|
|
|
}
|
2022-04-12 18:16:18 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
2022-04-13 20:24:26 +08:00
|
|
|
|
case Custom_Message_Sub_AnchorPK_Finish://个播PK完成
|
2022-04-12 18:16:18 +08:00
|
|
|
|
{
|
|
|
|
|
[self.anchorPKPanelView resetAcrossPKViewData];
|
|
|
|
|
[self.anchorPKPanelView removeFromSuperview];
|
2022-04-13 20:24:26 +08:00
|
|
|
|
self.anchorPKPanelView = nil;
|
2022-04-18 18:12:57 +08:00
|
|
|
|
[self resetAnchorPkInfo];
|
2022-04-13 20:24:26 +08:00
|
|
|
|
[[RtcManager instance] disconnectOtherRoom];
|
2022-07-14 18:55:40 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case Custom_Message_Sub_PK_BeginTime:{
|
|
|
|
|
long long time = [attachment.data[@"beginTime"] longLongValue];
|
|
|
|
|
[self showAcrossPkCountDownViewWithTime:time];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
|
|
|
|
break;
|
2022-01-11 14:38:55 +08:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2022-04-08 15:42:25 +08:00
|
|
|
|
} else if (attachment.first == CustomMessageType_Anchor_FansTeam) {
|
|
|
|
|
[self handleAnchorFansTeam:attachment];
|
2022-04-19 16:45:32 +08:00
|
|
|
|
} else if (attachment.first == CustomMessageType_Noble_VIP && attachment.second == Custom_Message_Sub_Room_Trumpet) {
|
|
|
|
|
[self handleTrumpet:attachment];
|
2022-04-08 15:42:25 +08:00
|
|
|
|
}
|
2022-02-15 17:23:18 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-01-11 14:38:55 +08:00
|
|
|
|
|
2022-03-15 18:38:36 +08:00
|
|
|
|
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
|
|
|
|
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
|
|
|
|
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
|
|
|
|
switch (content.eventType) {
|
|
|
|
|
case NIMChatroomEventTypeAddManager:
|
|
|
|
|
{
|
|
|
|
|
for (NIMChatroomNotificationMember * member in content.targets) {
|
|
|
|
|
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
self.editButton.hidden = NO;
|
2022-03-31 16:21:49 +08:00
|
|
|
|
self.roompkPanelView.isManager = YES;
|
2022-03-15 18:38:36 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
case NIMChatroomEventTypeRemoveManager:
|
|
|
|
|
{
|
|
|
|
|
for (NIMChatroomNotificationMember * member in content.targets) {
|
|
|
|
|
if (member.userId.intValue == [AccountInfoStorage instance].getUid.integerValue) {
|
|
|
|
|
self.editButton.hidden = YES;
|
2022-03-31 16:21:49 +08:00
|
|
|
|
self.roompkPanelView.isManager = NO;
|
2022-03-15 18:38:36 +08:00
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-24 16:25:16 +08:00
|
|
|
|
|
|
|
|
|
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
|
|
|
|
[self.littleGameMiniView needRefreshPosition:queue];
|
2022-03-29 16:22:21 +08:00
|
|
|
|
} else if(self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
2022-05-27 18:24:13 +08:00
|
|
|
|
self.roompkPanelView.micQueue = queue;
|
2022-05-11 20:38:09 +08:00
|
|
|
|
}else {
|
|
|
|
|
MicroQueueModel * currentUserModel;
|
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
|
for (MicroQueueModel * microModel in queue.allValues) {
|
|
|
|
|
if (microModel.userInfo && microModel.userInfo.uid == uid.integerValue) {
|
|
|
|
|
currentUserModel = microModel;
|
|
|
|
|
}
|
2022-05-09 22:18:42 +08:00
|
|
|
|
}
|
2022-05-11 20:38:09 +08:00
|
|
|
|
if (currentUserModel) {
|
|
|
|
|
if (!self.musicEnterButton.superview) {
|
|
|
|
|
[self addSubview:self.musicEnterButton];
|
2022-06-10 11:37:08 +08:00
|
|
|
|
CGFloat topOffY = self.delegate.getRoomInfo.type == RoomType_Anchor || self.delegate.getRoomInfo.isPermitRoom == PermitRoomType_Licnese ? (kNavigationHeight+ 4 + 22 + 18) : (kNavigationHeight+ 4);
|
2022-07-19 16:00:51 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) {//相亲厅播放音乐
|
|
|
|
|
[self.musicEnterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(self.hourRankEntranceView.mas_left).offset(-8);
|
|
|
|
|
make.centerY.mas_equalTo(self.contributeEnterView);
|
|
|
|
|
make.width.mas_equalTo(79);
|
|
|
|
|
make.height.mas_equalTo(22);
|
|
|
|
|
}];
|
|
|
|
|
} else {
|
|
|
|
|
[self.musicEnterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(0).offset(8);
|
|
|
|
|
make.top.mas_equalTo(topOffY);
|
|
|
|
|
make.width.mas_equalTo(79);
|
|
|
|
|
make.height.mas_equalTo(22);
|
|
|
|
|
}];
|
|
|
|
|
}
|
2022-05-11 20:38:09 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
[[RtcManager instance] changePlayState:BackMusicPlayState_Stop];
|
|
|
|
|
if (self.musicEnterButton) {
|
|
|
|
|
[self.musicEnterButton removeFromSuperview];
|
|
|
|
|
}
|
|
|
|
|
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
|
|
|
|
moveAnimation.fromValue = [NSValue valueWithCGPoint:self.musicPlayView.center];
|
|
|
|
|
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, self.musicPlayView.center.y)];
|
|
|
|
|
moveAnimation.beginTime = CACurrentMediaTime();
|
|
|
|
|
moveAnimation.duration = 0.5;
|
|
|
|
|
moveAnimation.repeatCount = 1;
|
|
|
|
|
moveAnimation.removedOnCompletion = YES;
|
|
|
|
|
[self.musicPlayView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
|
|
|
|
[self.musicPlayView resetData];
|
|
|
|
|
[self.musicPlayView removeFromSuperview];
|
2022-05-09 22:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2022-03-24 16:25:16 +08:00
|
|
|
|
}
|
2022-01-12 17:44:40 +08:00
|
|
|
|
#pragma mark - XPAcrpssRoomPKPanelViewDelegate
|
|
|
|
|
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view onlookRoom:(NSString *)roomUid {
|
|
|
|
|
[self.delegate exitRoom];
|
2022-01-12 18:48:39 +08:00
|
|
|
|
///这个为啥加个延迟的 因为会先退房 有一个dismiss的动画 所以加个延迟吧
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
|
|
|
|
});
|
2022-01-12 17:44:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view sendGiftToUser:(NSString *)uid {
|
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
|
|
|
|
XPSendGiftView * giftView = [[XPSendGiftView alloc] initWithType:SendGiftType_Room uid:roomUid];
|
|
|
|
|
giftView.delegate = self.delegate;
|
|
|
|
|
NSArray * giftUses = [self configGiftUsers:[self.delegate getMicroQueue]];
|
|
|
|
|
[giftView configGiftUsers:giftUses];
|
2022-03-23 17:15:46 +08:00
|
|
|
|
[self.delegate.getCurrentNav presentViewController:giftView animated:YES completion:nil];
|
2022-01-12 17:44:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSArray<XPGiftUserInfoModel *> *)configGiftUsers:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
|
|
|
|
NSMutableArray * array = [NSMutableArray array];
|
|
|
|
|
for (MicroQueueModel * microModel in queue.allValues) {
|
|
|
|
|
if (microModel.userInfo && microModel.userInfo.uid >0) {
|
|
|
|
|
UserInfoModel * userInfo = microModel.userInfo;
|
|
|
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
|
|
|
userModel.avatar = userInfo.avatar;
|
|
|
|
|
userModel.position = [NSString stringWithFormat:@"%d", microModel.microState.position];
|
|
|
|
|
userModel.uid = userInfo.uid;
|
|
|
|
|
[array addObject:userModel];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (self.delegate.getRoomInfo.leaveMode) {
|
|
|
|
|
RoomInfoModel * roomInfo= self.delegate.getRoomInfo;
|
|
|
|
|
XPGiftUserInfoModel * userModel = [[XPGiftUserInfoModel alloc] init];
|
|
|
|
|
userModel.avatar = roomInfo.avatar;
|
|
|
|
|
userModel.position = @"-1";
|
|
|
|
|
userModel.uid = roomInfo.uid;
|
|
|
|
|
[array addObject:userModel];
|
|
|
|
|
}
|
|
|
|
|
return array;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)xPAcrpssRoomPKPanelView:(XPAcrpssRoomPKPanelView *)view showUserCard:(NSString *)uid {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSString * targetUid = uid;
|
|
|
|
|
XPUserCardInfoModel * model = [[XPUserCardInfoModel alloc] init];
|
|
|
|
|
[[self.delegate.getMicroQueue allValues] enumerateObjectsUsingBlock:^(MicroQueueModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
|
|
|
|
if (targetUid.integerValue == obj.userInfo.uid) {
|
|
|
|
|
model.position = [NSString stringWithFormat:@"%d", obj.microState.position];
|
|
|
|
|
model.posState = obj.microState.posState;
|
|
|
|
|
model.micState = obj.microState.micState;
|
|
|
|
|
*stop = YES;
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
model.nick = self.delegate.getUserInfo.nick;
|
|
|
|
|
model.uid = targetUid;
|
|
|
|
|
model.delegate = self.delegate;
|
|
|
|
|
model.roomInfo = roomInfo;
|
|
|
|
|
model.micQueue = self.delegate.getMicroQueue;
|
2022-04-18 22:36:16 +08:00
|
|
|
|
model.superMangerList = self.delegate.getRoomSuperAdminList;
|
2022-01-12 17:44:40 +08:00
|
|
|
|
XPUserCardViewController * userCardVC = [[XPUserCardViewController alloc] initWithUser:model];
|
|
|
|
|
[self.delegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-11 19:11:34 +08:00
|
|
|
|
#pragma mark - XPAnchorPkPanelViewDelegate
|
|
|
|
|
- (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view showUserCard:(NSString *)uid {
|
2022-04-20 21:16:32 +08:00
|
|
|
|
XPMineUserInfoViewController * userInfoVC = [[XPMineUserInfoViewController alloc] init];
|
|
|
|
|
userInfoVC.uid = uid.integerValue;
|
|
|
|
|
[self.delegate.getCurrentNav pushViewController:userInfoVC animated:YES];
|
2022-04-11 19:11:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-14 19:34:48 +08:00
|
|
|
|
///去房间
|
|
|
|
|
- (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view onlookRoom:(NSString *)roomUid {
|
|
|
|
|
[self.delegate exitRoom];
|
|
|
|
|
///这个为啥加个延迟的 因为会先退房 有一个dismiss的动画 所以加个延迟吧
|
|
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 10:49:38 +08:00
|
|
|
|
///关注房主成功
|
|
|
|
|
- (void)xPAnchorPKPanelViewAttentionSuccess {
|
|
|
|
|
if (self.followAnchorTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.followAnchorTimer);
|
|
|
|
|
self.followAnchorTimer = nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 18:12:57 +08:00
|
|
|
|
- (void)xPAnchorPKPanelViewPenaltyCountDownEnd {
|
|
|
|
|
self.delegate.getRoomInfo.pkState = AcrossRoomPkStateTypePenaltyEnd;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 20:38:09 +08:00
|
|
|
|
#pragma mark - XPRoomBackMusicPlayerViewDelegate
|
|
|
|
|
- (void)xPRoomBackMusicPlayerView:(XPRoomBackMusicPlayerView *)view musicPlaying:(BOOL)musicPlaying {
|
|
|
|
|
if (musicPlaying) {
|
|
|
|
|
[self resumeLayer:self.musicEnterButton.imageView.layer];
|
|
|
|
|
} else {
|
|
|
|
|
[self pauseLayer:self.musicEnterButton.imageView.layer];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
#pragma mark - Event Response
|
2022-04-27 18:05:46 +08:00
|
|
|
|
- (void)contributionButtonAction:(UITapGestureRecognizer *)tap {
|
2021-12-15 18:12:55 +08:00
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
2022-01-14 11:38:09 +08:00
|
|
|
|
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
|
|
|
|
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kRoomRankURL), roomUid];
|
|
|
|
|
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
2022-04-29 16:56:53 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_Anchor) {//点击的时候更新一下
|
|
|
|
|
[self updateContrionEntranceWithRoomUid:roomUid type:@"month"];
|
|
|
|
|
} else {
|
|
|
|
|
[self updateContrionEntranceWithRoomUid:roomUid type:@"day"];
|
|
|
|
|
}
|
2021-12-15 18:12:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-05-12 20:18:57 +08:00
|
|
|
|
- (void)onAnchorHourRankButtonAction:(UITapGestureRecognizer *)ges {
|
2022-04-18 20:53:40 +08:00
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
2022-06-13 19:07:07 +08:00
|
|
|
|
NSString * url = self.delegate.getRoomInfo.type == RoomType_Anchor ? URLWithType(kRoomHourRankURL) : URLWithType(kLicenseHourRankURL);
|
2022-04-18 20:53:40 +08:00
|
|
|
|
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
2022-06-13 19:07:07 +08:00
|
|
|
|
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", url, roomUid];
|
2022-04-18 20:53:40 +08:00
|
|
|
|
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-06 11:12:32 +08:00
|
|
|
|
- (void)datingProgresButtonAction:(UIButton *)sender {
|
|
|
|
|
[TTPopup dismiss];
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSString * message = @"";
|
|
|
|
|
if (roomInfo.blindDateState == RoomPlayDateingType_Talk) {
|
|
|
|
|
message = @"进入心动选人环节?";
|
|
|
|
|
} else if(roomInfo.blindDateState == RoomPlayDateingType_Pick) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
message = @"进入心动公布环节?";
|
2022-01-06 11:12:32 +08:00
|
|
|
|
} else if(roomInfo.blindDateState == RoomPlayDateingType_Result) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
message = @"结束本轮,同时清空魅力值?";
|
2022-01-06 11:12:32 +08:00
|
|
|
|
} else if (roomInfo.blindDateState == RoomPlayDateingType_Finish) {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
message = @"进入嘉宾交流环节?";
|
2022-01-06 11:12:32 +08:00
|
|
|
|
}
|
|
|
|
|
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
|
|
|
|
config.message = message;
|
|
|
|
|
[TTPopup alertWithConfig:config confirmHandler:^{
|
|
|
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
|
|
|
|
NSString * roundId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.blindDateState];
|
|
|
|
|
[Api changeRoomDatingState:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
|
}
|
|
|
|
|
} roomUserId:roomUid roundId:roundId];
|
|
|
|
|
} cancelHandler:^{
|
|
|
|
|
|
2022-02-14 14:22:03 +08:00
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)foldButtonAction:(UIButton *)sender {
|
|
|
|
|
sender.selected = !sender.selected;
|
|
|
|
|
}
|
2022-01-06 11:12:32 +08:00
|
|
|
|
|
2022-04-07 15:02:22 +08:00
|
|
|
|
- (void)tapFansTeamRecognizer {
|
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
|
2022-04-07 21:13:19 +08:00
|
|
|
|
if (self.relationFansModel.isCurrentRoomAnchor) {///是房主
|
|
|
|
|
if (self.relationFansModel.hasFansTeamCurrentRoom) {
|
2022-04-08 15:42:25 +08:00
|
|
|
|
XPRoomHalfWebView * webView = [[XPRoomHalfWebView alloc] init];
|
|
|
|
|
webView.url = [NSString stringWithFormat:@"%@?roomUid=%@", URLWithType(kAnchorFansListURL), roomUid];
|
|
|
|
|
[TTPopup popupView:webView style:TTPopupStyleActionSheet];
|
2022-04-07 15:02:22 +08:00
|
|
|
|
} else {
|
2022-04-08 15:42:25 +08:00
|
|
|
|
XPWebViewController * webVC =[[XPWebViewController alloc] init];
|
|
|
|
|
webVC.roomUid = roomUid;
|
2022-04-07 15:02:22 +08:00
|
|
|
|
webVC.url = URLWithType(kAnchorFansOpenURL);
|
2022-04-08 15:42:25 +08:00
|
|
|
|
[self.delegate.getCurrentNav pushViewController:webVC animated:YES];
|
2022-04-07 15:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
} else {
|
2022-04-07 21:13:19 +08:00
|
|
|
|
if (self.relationFansModel.hasFansTeamCurrentRoom) {//开通了粉丝团
|
|
|
|
|
if (self.relationFansModel.isAnchorFans) {
|
|
|
|
|
[Api requestFansTeamTask:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code != 200) {
|
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
XPAnchorFansTaskModel *model = [XPAnchorFansTaskModel modelWithJSON:data.data];
|
|
|
|
|
XPAnchorFansTaskViewController *fansTaskVc = [[XPAnchorFansTaskViewController alloc] initWithRoomUid:roomUid];
|
|
|
|
|
fansTaskVc.model = model;
|
|
|
|
|
[self.delegate.getCurrentNav presentViewController:fansTaskVc animated:YES completion:nil];
|
|
|
|
|
} teamUid:roomUid];
|
|
|
|
|
} else {
|
|
|
|
|
[Api requestJoinFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code != 200) {
|
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
XPAnchorFansJoinModel *model = [XPAnchorFansJoinModel modelWithJSON:data.data];
|
|
|
|
|
XPAnchorFansTeamViewController *fansTeamVc = [[XPAnchorFansTeamViewController alloc] initWithRoomUid:roomUid];
|
|
|
|
|
fansTeamVc.model = model;
|
|
|
|
|
[self.delegate.getCurrentNav presentViewController:fansTeamVc animated:YES completion:nil];
|
|
|
|
|
} teamUid:roomUid];
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-04-07 15:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 22:18:42 +08:00
|
|
|
|
- (void)musicEnterButtonAction:(UIButton *)sender {
|
|
|
|
|
if (!self.musicPlayView.superview) {
|
|
|
|
|
[self addSubview:self.musicPlayView];
|
|
|
|
|
self.musicPlayView.frame = CGRectMake(-KScreenWidth, kNavigationHeight + 4, KScreenWidth - 85, 80);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
POPBasicAnimation *moveAnimation = [POPBasicAnimation animationWithPropertyNamed:kPOPViewCenter];
|
|
|
|
|
moveAnimation.fromValue = [NSValue valueWithCGPoint:CGPointMake(-KScreenWidth, self.musicPlayView.center.y)];
|
|
|
|
|
moveAnimation.toValue = [NSValue valueWithCGPoint:CGPointMake(KScreenWidth/ 2, self.musicPlayView.center.y)];
|
|
|
|
|
moveAnimation.beginTime = CACurrentMediaTime();
|
|
|
|
|
moveAnimation.duration = 0.5;
|
|
|
|
|
moveAnimation.repeatCount = 1;
|
|
|
|
|
moveAnimation.removedOnCompletion = YES;
|
|
|
|
|
[self.musicPlayView pop_addAnimation:moveAnimation forKey:@"moveOutAnimation"];
|
|
|
|
|
|
|
|
|
|
[UIView animateWithDuration:0.2 animations:^{
|
|
|
|
|
self.musicEnterButton.hidden = YES;
|
|
|
|
|
} completion:nil];
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 19:46:10 +08:00
|
|
|
|
#pragma mark - 房间话题
|
|
|
|
|
- (void)updateRoomTopicViewConstraint {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
CGFloat offsetY = kNavigationHeight;
|
2022-04-07 11:31:45 +08:00
|
|
|
|
if (roomInfo.roomModeType == RoomModeType_Open_Blind) {
|
2022-05-13 18:41:52 +08:00
|
|
|
|
offsetY += ((58 + 5) * kScreenScale + 10 + 12 + 3 + 40);
|
2022-03-14 19:46:10 +08:00
|
|
|
|
} else if (roomInfo.type == RoomType_Anchor) {
|
2022-03-15 15:23:27 +08:00
|
|
|
|
offsetY += (120 + 5 + 6 + 20 +60 + 3);
|
|
|
|
|
} else {
|
2022-05-13 18:41:52 +08:00
|
|
|
|
offsetY += (58 + 5 + 10 + 12 + 3 + 40);
|
2022-01-11 14:38:55 +08:00
|
|
|
|
}
|
2022-03-14 19:46:10 +08:00
|
|
|
|
|
|
|
|
|
[self.topicStackView mas_updateConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(offsetY);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)updateRoomTopic {
|
2022-04-14 19:34:48 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_Anchor && self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
|
|
|
|
self.topicStackView.hidden = YES;
|
|
|
|
|
} else {
|
|
|
|
|
self.topicStackView.hidden = ([ClientConfig shareConfig].configInfo.appStoreAuditNoticeVersion || self.delegate.getRoomInfo.type == RoomType_MiniGame) == YES;
|
|
|
|
|
}
|
2022-03-14 19:46:10 +08:00
|
|
|
|
[self updateRoomTopicViewConstraint];
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error== nil) {
|
|
|
|
|
NIMChatroomMember* member = members.firstObject;
|
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
|
|
|
|
|
self.editButton.hidden = NO;
|
|
|
|
|
} else {
|
|
|
|
|
self.editButton.hidden = YES;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
self.topicLabel.text = self.delegate.getRoomInfo.roomDesc.length > 0 ? self.delegate.getRoomInfo.roomDesc : @"暂未设置话题";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)topicGestureRecognizer:(UITapGestureRecognizer *)tap {
|
|
|
|
|
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
|
|
|
|
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
|
|
|
|
request.userIds = @[[AccountInfoStorage instance].getUid];
|
|
|
|
|
[[NIMSDK sharedSDK].chatroomManager fetchChatroomMembersByIds:request completion:^(NSError * _Nullable error, NSArray<NIMChatroomMember *> * _Nullable members) {
|
|
|
|
|
if (error== nil) {
|
|
|
|
|
NIMChatroomMember* member = members.firstObject;
|
|
|
|
|
RoomInfoModel * roomInfo= self.delegate.getRoomInfo;
|
|
|
|
|
if (member.type == NIMChatroomMemberTypeCreator || member.type == NIMChatroomMemberTypeManager) {
|
|
|
|
|
XPRoomTopicViewController * editTopicVC = [[XPRoomTopicViewController alloc] init];
|
|
|
|
|
editTopicVC.roomInfo = roomInfo;
|
|
|
|
|
[self.delegate.getCurrentNav pushViewController:editTopicVC animated:YES];
|
|
|
|
|
} else {
|
2022-03-15 11:16:00 +08:00
|
|
|
|
TTPopupService * config = [[TTPopupService alloc] init];
|
|
|
|
|
XPRoomTopicAlertView * alertView = [[XPRoomTopicAlertView alloc] init];
|
|
|
|
|
alertView.title = roomInfo.roomDesc;
|
|
|
|
|
alertView.message = roomInfo.introduction;
|
|
|
|
|
config.contentView = alertView;
|
|
|
|
|
[TTPopup popupWithConfig:config];
|
2022-03-14 19:46:10 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#pragma mark - 个播模式弹窗关注主播
|
|
|
|
|
- (void)setFollowAnchorTimer {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
if (self.followAnchorTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.followAnchorTimer);
|
|
|
|
|
}
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#ifdef DEBUG
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NSInteger totalTime = 5;
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#else
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NSInteger totalTime = 420;
|
2022-02-15 17:23:18 +08:00
|
|
|
|
#endif
|
2022-01-11 14:38:55 +08:00
|
|
|
|
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
|
|
|
|
self.followAnchorTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
|
|
|
|
dispatch_source_set_timer(self.followAnchorTimer,dispatch_walltime(NULL, totalTime*NSEC_PER_SEC), totalTime*NSEC_PER_SEC, 0); //每秒执行
|
|
|
|
|
@weakify(self);
|
|
|
|
|
dispatch_source_set_event_handler(self.followAnchorTimer, ^{
|
|
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
|
|
|
@strongify(self);
|
|
|
|
|
if (self.followAnchorTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.followAnchorTimer);
|
|
|
|
|
self.followAnchorTimer = nil;
|
|
|
|
|
}
|
|
|
|
|
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
|
|
|
|
NSString * uid = [[AccountInfoStorage instance] getUid];
|
|
|
|
|
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
|
|
|
|
if (!isLike) { // 还没有关注
|
|
|
|
|
if (self.window) {
|
|
|
|
|
[self showFollowAnchorView];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} uid:uid isLikeUid:roomUid];
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
dispatch_resume(self.followAnchorTimer);
|
2022-02-15 17:23:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//弹出关注主播的窗口
|
|
|
|
|
- (void)showFollowAnchorView {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
|
|
|
|
|
[Api getUserInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
UserInfoModel *userInfo = [UserInfoModel modelWithDictionary:data.data];
|
|
|
|
|
XPRoomAnchorInfoCardView *view = [[XPRoomAnchorInfoCardView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, 300)];
|
|
|
|
|
view.userInfo = self.delegate.getUserInfo;
|
|
|
|
|
view.targetUserInfo = userInfo;
|
|
|
|
|
view.roomId =roomInfo.roomId;
|
|
|
|
|
[TTPopup popupView:view style:TTPopupStyleActionSheet];
|
|
|
|
|
} uid:roomUid];
|
2022-02-15 17:23:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-02-17 11:47:09 +08:00
|
|
|
|
///个播房用户请求上麦弹窗
|
|
|
|
|
- (void)showAskForUpMic:(NSDictionary *)dict {
|
2022-01-11 14:38:55 +08:00
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%zd", self.delegate.getRoomInfo.uid];
|
|
|
|
|
if (![roomUid isEqualToString:[AccountInfoStorage instance].getUid]) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
UserInfoModel *model = [UserInfoModel modelWithJSON:dict];
|
|
|
|
|
XPAnchorAudienceUpMicView *upMicView = [[XPAnchorAudienceUpMicView alloc] initWithFrame:CGRectMake(0, 0, 300, 226) delegate:self.delegate];
|
|
|
|
|
upMicView.info = model;
|
|
|
|
|
TTPopupConfig *config = [[TTPopupConfig alloc] init];
|
|
|
|
|
config.filterIdentifier = @"audienceRequestUpMic";
|
|
|
|
|
config.shouldFilterPopup = YES;
|
|
|
|
|
config.contentView = upMicView;
|
|
|
|
|
config.style = TTPopupStyleAlert;
|
|
|
|
|
[TTPopup popupWithConfig:config];
|
2022-02-17 11:47:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 15:02:22 +08:00
|
|
|
|
#pragma mark - 个播粉丝团
|
|
|
|
|
- (void)updateFansTeamEntranceView:(XPAnchorFansRelationModel *)model {
|
2022-05-13 16:11:24 +08:00
|
|
|
|
if (!self.fansTeamEntranceView.superview) {
|
2022-05-13 21:19:56 +08:00
|
|
|
|
[self insertSubview:self.fansTeamEntranceView atIndex:0];
|
2022-05-13 16:11:24 +08:00
|
|
|
|
[self.fansTeamEntranceView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(5);
|
|
|
|
|
make.left.mas_equalTo(0);
|
|
|
|
|
make.height.mas_equalTo(37);
|
|
|
|
|
}];
|
|
|
|
|
}
|
2022-04-07 21:13:19 +08:00
|
|
|
|
self.fansTeamEntranceView.model = model;
|
|
|
|
|
self.relationFansModel = model;
|
2022-04-07 15:02:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-04-08 15:42:25 +08:00
|
|
|
|
- (void)handleAnchorFansTeam:(AttachmentModel *)attachment {
|
|
|
|
|
if (attachment.second == Custom_Message_Sub_FansTeam_Open_Success || attachment.second == Custom_Message_Sub_FansTeam_Join_Success || attachment.second == Custom_Message_Sub_FansTeam_Out_Success) {
|
|
|
|
|
NSString *roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
|
|
|
|
NSString *uid;
|
|
|
|
|
if ([attachment.data[@"uid"] isKindOfClass:[NSNumber class]]) {
|
|
|
|
|
uid = [NSString stringWithFormat:@"%@", attachment.data[@"uid"]];
|
|
|
|
|
} else if ([attachment.data[@"uid"] isKindOfClass:[NSString class]]) {
|
|
|
|
|
uid = attachment.data[@"uid"];
|
|
|
|
|
}
|
2022-04-15 14:12:33 +08:00
|
|
|
|
if ([uid isEqualToString:[AccountInfoStorage instance].getUid] || [[AccountInfoStorage instance].getUid isEqualToString:roomUid]) {
|
2022-04-08 15:42:25 +08:00
|
|
|
|
[Api requestInRoomFansTeam:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
XPAnchorFansRelationModel *model = [XPAnchorFansRelationModel modelWithJSON:data.data];
|
|
|
|
|
[self updateFansTeamEntranceView:model];
|
|
|
|
|
} teamUid:roomUid];
|
|
|
|
|
}
|
|
|
|
|
} else if (attachment.second == Custom_Message_Sub_FansTeam_Open_Fail) {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 18:12:57 +08:00
|
|
|
|
- (void)updateAnchorPkInfo:(AcrossRoomPKPanelModel *)acrossPKPanelInfo {
|
|
|
|
|
self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId;
|
|
|
|
|
self.delegate.getRoomInfo.pkUid = acrossPKPanelInfo.aUid;
|
|
|
|
|
self.delegate.getRoomInfo.pkRoomId = acrossPKPanelInfo.aRoomId;
|
|
|
|
|
self.delegate.getRoomInfo.pkState = acrossPKPanelInfo.pkState;
|
|
|
|
|
self.delegate.getRoomInfo.winUid = acrossPKPanelInfo.winUid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)resetAnchorPkInfo {
|
|
|
|
|
self.delegate.getRoomInfo.roundId = nil;
|
|
|
|
|
self.delegate.getRoomInfo.pkUid = nil;
|
|
|
|
|
self.delegate.getRoomInfo.pkRoomId = nil;
|
|
|
|
|
self.delegate.getRoomInfo.pkState = nil;
|
|
|
|
|
self.delegate.getRoomInfo.winUid = nil;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-19 16:45:32 +08:00
|
|
|
|
#pragma mark - 房间贵族小喇叭
|
|
|
|
|
- (void)handleTrumpet:(AttachmentModel *)attachment {
|
|
|
|
|
if (self.trumpetQueue.count) {
|
|
|
|
|
[self.trumpetQueue addObject:attachment.data];
|
|
|
|
|
} else {
|
|
|
|
|
[self.trumpetQueue addObject:attachment.data];
|
|
|
|
|
__block NSInteger time = 5.0; //倒计时时间
|
|
|
|
|
if (_trumpetTimer == nil) {
|
|
|
|
|
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
|
|
|
|
|
_trumpetTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
|
|
|
|
|
dispatch_source_set_timer(_trumpetTimer,dispatch_walltime(NULL, 0), time*NSEC_PER_SEC, 0); //每秒执行
|
|
|
|
|
@weakify(self);
|
|
|
|
|
dispatch_source_set_event_handler(_trumpetTimer, ^{
|
|
|
|
|
@strongify(self);
|
|
|
|
|
if (self.trumpetQueue.count) {
|
|
|
|
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
|
|
[self createTrumpetAnimation:self.trumpetQueue.firstObject];
|
|
|
|
|
[self.trumpetQueue removeObjectAtIndex:0];
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
dispatch_sync(dispatch_get_main_queue(), ^{
|
|
|
|
|
[self.trumpetView removeFromSuperview];
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
if (self.trumpetTimer != nil) {
|
|
|
|
|
dispatch_source_cancel(self.trumpetTimer);
|
|
|
|
|
self.trumpetTimer = nil;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
dispatch_resume(_trumpetTimer);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)createTrumpetAnimation:(NSDictionary *)attatchment {
|
|
|
|
|
if (!self.trumpetView.superview) {
|
|
|
|
|
[self addSubview:self.trumpetView];
|
|
|
|
|
[self.trumpetView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.top.mas_equalTo(self.delegate.getRoomInfo.type == RoomType_MiniGame ? kNavigationHeight: kNavigationHeight + 110);
|
|
|
|
|
make.left.mas_equalTo(0);
|
|
|
|
|
make.right.mas_equalTo(0);
|
|
|
|
|
make.height.mas_equalTo(153);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
self.trumpetView.data = attatchment;
|
|
|
|
|
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
|
|
|
|
|
animation2.beginTime = CACurrentMediaTime();
|
|
|
|
|
animation2.duration = 0.1;
|
|
|
|
|
CGFloat width = self.frame.size.width - 15;
|
|
|
|
|
CGFloat height = 28;
|
|
|
|
|
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 153-34-28, width, height)];
|
|
|
|
|
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, 153-34-28-14, width, height)];
|
|
|
|
|
animation2.removedOnCompletion = NO;
|
|
|
|
|
animation2.repeatCount = 1;
|
|
|
|
|
|
|
|
|
|
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
|
|
|
|
|
animation3.duration = 0.1;
|
|
|
|
|
animation3.beginTime = CACurrentMediaTime();
|
|
|
|
|
animation3.fromValue = @1;
|
|
|
|
|
animation3.toValue = @0;
|
|
|
|
|
animation3.repeatCount = 1;
|
|
|
|
|
animation3.removedOnCompletion = NO;
|
|
|
|
|
|
|
|
|
|
[animation2 setCompletionBlock:^(POPAnimation *anim, BOOL finished) {
|
|
|
|
|
if (finished) {
|
|
|
|
|
POPBasicAnimation *animation2 = [POPBasicAnimation animationWithPropertyNamed:kPOPViewFrame];
|
|
|
|
|
animation2.beginTime = CACurrentMediaTime();
|
|
|
|
|
animation2.duration = 0.1;
|
|
|
|
|
CGFloat width = self.frame.size.width - 15;
|
|
|
|
|
CGFloat height = 28;
|
|
|
|
|
animation2.fromValue = [NSValue valueWithCGRect:CGRectMake(0, 153 - 34 - 14, width, height)];
|
|
|
|
|
animation2.toValue = [NSValue valueWithCGRect:CGRectMake(0, 153 - 34 - 28, width, height)];
|
|
|
|
|
animation2.removedOnCompletion = NO;
|
|
|
|
|
animation2.repeatCount = 1;
|
|
|
|
|
|
|
|
|
|
POPBasicAnimation *animation3 = [POPBasicAnimation animationWithPropertyNamed:kPOPLayerOpacity];
|
|
|
|
|
animation3.duration = 0.1;
|
|
|
|
|
animation3.beginTime = CACurrentMediaTime();
|
|
|
|
|
animation3.fromValue = @0;
|
|
|
|
|
animation3.toValue = @1;
|
|
|
|
|
animation3.repeatCount = 1;
|
|
|
|
|
animation3.removedOnCompletion = NO;
|
|
|
|
|
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation4"];
|
|
|
|
|
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation5"];
|
|
|
|
|
}
|
|
|
|
|
}];
|
|
|
|
|
[self.trumpetView.mainView.layer pop_addAnimation:animation2 forKey:@"animation2"];
|
|
|
|
|
[self.trumpetView.mainView.layer pop_addAnimation:animation3 forKey:@"animation3"];
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-29 16:56:53 +08:00
|
|
|
|
#pragma mark - 房间榜入口榜单
|
|
|
|
|
- (void)updateContrionEntranceWithRoomUid:(NSString *)roomUid type:(NSString *)type {
|
|
|
|
|
[Api requestRoomRankings:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {//获取房间榜
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
NSMutableArray *array = [NSMutableArray array];
|
|
|
|
|
for (NSDictionary *dict in data.data[@"rankings"]) {
|
|
|
|
|
NSString *str = dict[@"avatar"];
|
|
|
|
|
if (str) {
|
|
|
|
|
[array addObject:str];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
self.contributeEnterView.array = array;
|
|
|
|
|
}
|
|
|
|
|
} roomUid:roomUid type:type page:@"1" pageSize:@"20"];
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-13 16:11:24 +08:00
|
|
|
|
#pragma mark - 个播小时榜入口
|
|
|
|
|
- (void)updateHourRankEntrance {
|
2022-06-07 17:51:32 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.type == RoomType_Anchor || self.delegate.getRoomInfo.isPermitRoom == PermitRoomType_Licnese) {
|
|
|
|
|
if (!self.hourRankEntranceView.superview) {
|
|
|
|
|
[self insertSubview:self.hourRankEntranceView atIndex:0];
|
|
|
|
|
[self.hourRankEntranceView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(0);
|
|
|
|
|
make.centerY.mas_equalTo(self.contributeEnterView);
|
|
|
|
|
make.width.mas_equalTo(69);
|
|
|
|
|
make.height.mas_equalTo(22);
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (self.hourRankEntranceView.superview) {[self.hourRankEntranceView removeFromSuperview];}
|
|
|
|
|
}
|
2022-05-13 16:11:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 11:20:28 +08:00
|
|
|
|
#pragma mark - XPRoomLittleGameListViewDelegate
|
|
|
|
|
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectItem:(LittleGameInfoModel *)itemInfo {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
NSMutableDictionary * params = [NSMutableDictionary dictionary];
|
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
|
NSString * ticket = [AccountInfoStorage instance].getTicket;
|
|
|
|
|
[params setObject:ticket forKey:@"ticket"];
|
|
|
|
|
[params setObject:uid forKey:@"uid"];
|
|
|
|
|
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.uid] forKey:@"roomUid"];
|
|
|
|
|
if (roomInfo.title.length > 0) {
|
|
|
|
|
[params setObject:roomInfo.title forKey:@"title"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (roomInfo.roomPwd.length > 0) {
|
|
|
|
|
[params setObject:roomInfo.roomPwd forKey:@"roomPwd"];
|
|
|
|
|
} else{
|
|
|
|
|
[params setObject:@"" forKey:@"roomPwd"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (roomInfo.tagId > 0) {
|
|
|
|
|
[params setObject:[NSString stringWithFormat:@"%ld", roomInfo.tagId] forKey:@"tagId"];
|
|
|
|
|
}
|
2022-04-01 23:41:44 +08:00
|
|
|
|
if ([itemInfo.mgId isEqualToString:@"0"]) {
|
2022-03-28 11:20:28 +08:00
|
|
|
|
[params setObject:@(RoomType_Game) forKey:@"type"];
|
2022-04-01 23:41:44 +08:00
|
|
|
|
[params setObject:@"0" forKey:@"mgId"];
|
2022-03-28 11:20:28 +08:00
|
|
|
|
} else {
|
|
|
|
|
[params setObject:@(RoomType_MiniGame) forKey:@"type"];
|
|
|
|
|
[params setObject:itemInfo.mgId forKey:@"mgId"];
|
|
|
|
|
}
|
|
|
|
|
[params setObject:@(roomInfo.hasAnimationEffect) forKey:@"hasAnimationEffect"];
|
|
|
|
|
[Api ownerUpdateRoomInfo:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
|
|
|
if (code == 200) {
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
[XCHUDTool showErrorWithMessage:msg];
|
|
|
|
|
}
|
|
|
|
|
} params:params];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)xPRoomLittleGameListView:(XPLittleGameRoomListView *)view didSelectChooseType:(UIButton *)sender {
|
2022-03-30 17:41:34 +08:00
|
|
|
|
if ([self currentRoomIsInSudGame]) {
|
2022-03-28 11:20:28 +08:00
|
|
|
|
[XCHUDTool showErrorWithMessage:@"游戏中不可切换游戏或玩法!"];
|
|
|
|
|
} else {
|
|
|
|
|
sender.selected = !sender.selected;
|
|
|
|
|
view.tableView.hidden = !sender.selected;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-11 20:38:09 +08:00
|
|
|
|
#pragma mark - 房间背景音乐
|
|
|
|
|
-(void)pauseLayer:(CALayer*)layer {
|
|
|
|
|
CFTimeInterval pausedTime = [layer convertTime:CACurrentMediaTime() fromLayer:nil];
|
|
|
|
|
layer.speed = 0.0;
|
|
|
|
|
layer.timeOffset = pausedTime;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
-(void)resumeLayer:(CALayer*)layer {
|
|
|
|
|
CFTimeInterval pausedTime = [layer timeOffset];
|
|
|
|
|
layer.speed = 1.0;
|
|
|
|
|
layer.timeOffset = 0.0;
|
|
|
|
|
layer.beginTime = 0.0;
|
|
|
|
|
CFTimeInterval timeSincePause = [layer convertTime:CACurrentMediaTime() fromLayer:nil] - pausedTime;
|
|
|
|
|
layer.beginTime = timeSincePause;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)configPlayMusicRoomTypeChange {
|
|
|
|
|
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
|
|
|
|
if (roomInfo.type == RoomType_MiniGame) {
|
|
|
|
|
[self pauseLayer:self.musicEnterButton.imageView.layer];
|
|
|
|
|
[self.musicEnterButton removeFromSuperview];
|
|
|
|
|
[self.musicPlayView resetData];
|
|
|
|
|
[self.musicPlayView removeFromSuperview];
|
|
|
|
|
[[RtcManager instance] changePlayState:BackMusicPlayState_Stop];
|
|
|
|
|
} else {
|
|
|
|
|
MicroQueueModel * currentUserModel;
|
|
|
|
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
|
|
|
|
for (MicroQueueModel * microModel in self.delegate.getMicroQueue.allValues) {
|
|
|
|
|
if (microModel.userInfo && microModel.userInfo.uid == uid.integerValue) {
|
|
|
|
|
currentUserModel = microModel;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (currentUserModel) {
|
|
|
|
|
if (!self.musicEnterButton.superview) {
|
|
|
|
|
[self addSubview:self.musicEnterButton];
|
2022-06-10 11:37:08 +08:00
|
|
|
|
CGFloat topOffY = (self.delegate.getRoomInfo.type == RoomType_Anchor || self.delegate.getRoomInfo.isPermitRoom == PermitRoomType_Licnese) ? (kNavigationHeight+ 4 + 22 + 18) : (kNavigationHeight+ 4);
|
2022-07-19 16:00:51 +08:00
|
|
|
|
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_Blind) {//相亲厅播放音乐
|
|
|
|
|
[self.musicEnterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(self.hourRankEntranceView.mas_left).offset(-8);
|
|
|
|
|
make.centerY.mas_equalTo(self.contributeEnterView);
|
|
|
|
|
make.width.mas_equalTo(79);
|
|
|
|
|
make.height.mas_equalTo(22);
|
|
|
|
|
}];
|
|
|
|
|
} else {
|
|
|
|
|
[self.musicEnterButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.right.mas_equalTo(0).offset(8);
|
|
|
|
|
make.top.mas_equalTo(topOffY);
|
|
|
|
|
make.width.mas_equalTo(79);
|
|
|
|
|
make.height.mas_equalTo(22);
|
|
|
|
|
}];
|
|
|
|
|
}
|
2022-05-11 20:38:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-14 18:55:40 +08:00
|
|
|
|
///跨房PK预约倒计时
|
|
|
|
|
- (void)showAcrossPkCountDownViewWithTime:(long long)time {
|
|
|
|
|
if (self.acrossPKCountView.superview) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (self.acrossPKPanelView.superview) {//正在PK中
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if ([self.delegate getRoomInfo].roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
[self addSubview:self.acrossPKCountView];
|
|
|
|
|
self.acrossPKCountView.startTime = time;
|
|
|
|
|
[self.acrossPKCountView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
|
|
make.left.mas_equalTo(0);
|
|
|
|
|
make.height.mas_equalTo(34);
|
|
|
|
|
make.width.mas_equalTo(130);
|
|
|
|
|
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(4);
|
|
|
|
|
}];
|
|
|
|
|
[UIView animateWithDuration:0.5 animations:^{
|
|
|
|
|
CGRect frame = self.acrossPKCountView.frame;
|
|
|
|
|
frame.origin.x = 0;
|
|
|
|
|
self.acrossPKCountView.frame = frame;
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
#pragma mark - Getters And Setters
|
2022-04-27 18:05:46 +08:00
|
|
|
|
- (XPRoomRankEntranceView *)contributeEnterView {
|
|
|
|
|
if (!_contributeEnterView) {
|
|
|
|
|
_contributeEnterView = [[XPRoomRankEntranceView alloc] init];
|
|
|
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(contributionButtonAction:)];
|
|
|
|
|
[_contributeEnterView addGestureRecognizer:tap];
|
|
|
|
|
}
|
|
|
|
|
return _contributeEnterView;
|
2021-12-15 18:12:55 +08:00
|
|
|
|
}
|
2022-01-06 11:12:32 +08:00
|
|
|
|
|
2022-05-12 20:18:57 +08:00
|
|
|
|
- (XPRoomAnchorRankEnterView *)hourRankEntranceView {
|
|
|
|
|
if (!_hourRankEntranceView) {
|
|
|
|
|
_hourRankEntranceView = [[XPRoomAnchorRankEnterView alloc] init];
|
|
|
|
|
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onAnchorHourRankButtonAction:)];
|
|
|
|
|
[_hourRankEntranceView addGestureRecognizer:tap];
|
2022-04-18 20:53:40 +08:00
|
|
|
|
}
|
2022-05-12 20:18:57 +08:00
|
|
|
|
return _hourRankEntranceView;
|
2022-04-18 20:53:40 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-01-06 11:12:32 +08:00
|
|
|
|
- (UIButton *)datingProgresButton {
|
|
|
|
|
if (!_datingProgresButton) {
|
|
|
|
|
_datingProgresButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_datingProgresButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFA7186), UIColorFromRGB(0xFA4972)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(65, 30)] forState:UIControlStateNormal];
|
|
|
|
|
[_datingProgresButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
|
_datingProgresButton.titleLabel.font = [UIFont systemFontOfSize:13];
|
|
|
|
|
[_datingProgresButton setTitle:@"开始选择>" forState:UIControlStateNormal];
|
|
|
|
|
[_datingProgresButton addTarget:self action:@selector(datingProgresButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
_datingProgresButton.layer.masksToBounds = YES;
|
|
|
|
|
_datingProgresButton.layer.cornerRadius = 15;
|
|
|
|
|
}
|
|
|
|
|
return _datingProgresButton;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-07 15:02:22 +08:00
|
|
|
|
- (XPAnchorFansTeamEntranceView *)fansTeamEntranceView {
|
|
|
|
|
if (!_fansTeamEntranceView) {
|
|
|
|
|
_fansTeamEntranceView = [[XPAnchorFansTeamEntranceView alloc]init];
|
|
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapFansTeamRecognizer)];
|
|
|
|
|
[_fansTeamEntranceView addGestureRecognizer:tap];
|
|
|
|
|
}
|
|
|
|
|
return _fansTeamEntranceView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 19:46:10 +08:00
|
|
|
|
- (UIStackView *)topicStackView {
|
|
|
|
|
if (!_topicStackView) {
|
|
|
|
|
_topicStackView = [[UIStackView alloc] init];
|
|
|
|
|
_topicStackView.axis = UILayoutConstraintAxisHorizontal;
|
|
|
|
|
_topicStackView.distribution = UIStackViewDistributionFill;
|
|
|
|
|
_topicStackView.alignment = UIStackViewAlignmentFill;
|
|
|
|
|
_topicStackView.spacing = 3;
|
|
|
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(topicGestureRecognizer:)];
|
|
|
|
|
[_topicStackView addGestureRecognizer:tap];
|
|
|
|
|
}
|
|
|
|
|
return _topicStackView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UILabel *)topicLabel {
|
|
|
|
|
if (!_topicLabel) {
|
|
|
|
|
_topicLabel = [[UILabel alloc] init];
|
|
|
|
|
_topicLabel.font = [UIFont systemFontOfSize:12];
|
|
|
|
|
_topicLabel.textColor = [UIColor whiteColor];
|
|
|
|
|
}
|
|
|
|
|
return _topicLabel;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (UIButton *)editButton {
|
|
|
|
|
if (!_editButton) {
|
|
|
|
|
_editButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_editButton setImage:[UIImage imageNamed:@"room_postion_topic_edit"] forState:UIControlStateNormal];
|
|
|
|
|
[_editButton setImage:[UIImage imageNamed:@"room_postion_topic_edit"] forState:UIControlStateSelected];
|
|
|
|
|
_editButton.hidden = YES;
|
|
|
|
|
}
|
|
|
|
|
return _editButton;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-11 20:01:58 +08:00
|
|
|
|
- (XPAcrpssRoomPKPanelView *)acrossPKPanelView {
|
|
|
|
|
if (!_acrossPKPanelView) {
|
|
|
|
|
_acrossPKPanelView = [[XPAcrpssRoomPKPanelView alloc] init];
|
2022-01-12 17:44:40 +08:00
|
|
|
|
_acrossPKPanelView.delegate = self;
|
2022-01-11 20:01:58 +08:00
|
|
|
|
}
|
|
|
|
|
return _acrossPKPanelView;
|
|
|
|
|
}
|
2022-02-15 14:38:09 +08:00
|
|
|
|
|
|
|
|
|
- (XPLittleGameMiniStageView *)littleGameMiniView {
|
|
|
|
|
if (!_littleGameMiniView) {
|
|
|
|
|
_littleGameMiniView = [[XPLittleGameMiniStageView alloc] init];
|
|
|
|
|
}
|
|
|
|
|
return _littleGameMiniView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 11:20:28 +08:00
|
|
|
|
- (XPLittleGameRoomListView *)gameListView {
|
|
|
|
|
if (!_gameListView) {
|
|
|
|
|
_gameListView = [[XPLittleGameRoomListView alloc] init];
|
|
|
|
|
_gameListView.delegate = self;
|
|
|
|
|
}
|
|
|
|
|
return _gameListView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-11 19:11:34 +08:00
|
|
|
|
- (XPAnchorPkPanelView *)anchorPKPanelView {
|
|
|
|
|
if (!_anchorPKPanelView) {
|
|
|
|
|
_anchorPKPanelView = [[XPAnchorPkPanelView alloc] init];
|
|
|
|
|
_anchorPKPanelView.delegate = self;
|
|
|
|
|
}
|
|
|
|
|
return _anchorPKPanelView;
|
|
|
|
|
}
|
2022-02-15 14:38:09 +08:00
|
|
|
|
|
2022-03-28 22:04:09 +08:00
|
|
|
|
|
2022-04-19 16:45:32 +08:00
|
|
|
|
- (XPRoomTrumpetView *)trumpetView {
|
|
|
|
|
if (!_trumpetView) {
|
|
|
|
|
_trumpetView = [[XPRoomTrumpetView alloc] init];
|
|
|
|
|
}
|
|
|
|
|
return _trumpetView;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (NSMutableArray *)trumpetQueue {
|
|
|
|
|
if (!_trumpetQueue) {
|
|
|
|
|
_trumpetQueue = [NSMutableArray array];
|
|
|
|
|
}
|
|
|
|
|
return _trumpetQueue;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-09 22:18:42 +08:00
|
|
|
|
- (UIButton *)musicEnterButton {
|
|
|
|
|
if (!_musicEnterButton) {
|
|
|
|
|
_musicEnterButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
[_musicEnterButton setTitle:@"播放音乐" forState:UIControlStateNormal];
|
|
|
|
|
[_musicEnterButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
|
|
|
_musicEnterButton.titleLabel.font = [UIFont systemFontOfSize:10];
|
|
|
|
|
[_musicEnterButton setImage:[UIImage imageNamed:@"room_music_player_enter"] forState:UIControlStateNormal];
|
|
|
|
|
_musicEnterButton.layer.masksToBounds = YES;
|
|
|
|
|
_musicEnterButton.layer.cornerRadius = 11;
|
|
|
|
|
_musicEnterButton.imageEdgeInsets = UIEdgeInsetsMake(0, -15, 0, 0);
|
|
|
|
|
_musicEnterButton.backgroundColor = UIColorRGBAlpha(0xffffff, 0.2);
|
|
|
|
|
[_musicEnterButton addTarget:self action:@selector(musicEnterButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
2022-05-11 20:38:09 +08:00
|
|
|
|
CAKeyframeAnimation *lAni = [CAKeyframeAnimation animationWithKeyPath:@"transform.rotation.z"];
|
|
|
|
|
lAni.duration = 1.5;
|
|
|
|
|
lAni.repeatCount = HUGE;
|
|
|
|
|
lAni.values=@[@0,@(M_PI*2)];
|
|
|
|
|
//使得动画结束后,保持动画效果
|
|
|
|
|
lAni.removedOnCompletion = NO;
|
|
|
|
|
lAni.fillMode = kCAFillModeForwards;
|
|
|
|
|
[_musicEnterButton.imageView.layer addAnimation:lAni forKey:nil];
|
2022-05-09 22:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
return _musicEnterButton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (XPRoomBackMusicPlayerView *)musicPlayView {
|
|
|
|
|
if (!_musicPlayView) {
|
|
|
|
|
_musicPlayView = [[XPRoomBackMusicPlayerView alloc] init];
|
2022-05-11 20:38:09 +08:00
|
|
|
|
_musicPlayView.delegate = self;
|
2022-05-09 22:18:42 +08:00
|
|
|
|
}
|
|
|
|
|
return _musicPlayView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-28 22:04:09 +08:00
|
|
|
|
- (XPRoomPKProgressView *)roompkPanelView {
|
|
|
|
|
if (!_roompkPanelView) {
|
|
|
|
|
_roompkPanelView = [[XPRoomPKProgressView alloc] init];
|
|
|
|
|
}
|
|
|
|
|
return _roompkPanelView;
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-14 18:55:40 +08:00
|
|
|
|
- (XPAcrossRoomPKCountDownView *)acrossPKCountView {
|
|
|
|
|
if (!_acrossPKCountView) {
|
|
|
|
|
_acrossPKCountView = [[XPAcrossRoomPKCountDownView alloc] initWithFrame:CGRectMake(-130, kNavigationHeight+4+22+4, 130, 34)];
|
|
|
|
|
}
|
|
|
|
|
return _acrossPKCountView;
|
|
|
|
|
}
|
2022-03-28 22:04:09 +08:00
|
|
|
|
|
2021-12-15 18:12:55 +08:00
|
|
|
|
@end
|