个播随机PK匹配计时、取消匹配逻辑
This commit is contained in:
@@ -91,6 +91,7 @@
|
||||
#import "XPAnchorPkPanelView.h"
|
||||
#import "XPWebViewController.h"
|
||||
#import "XPRoomPKProgressView.h"
|
||||
#import "XPAnchorPKMatchView.h"
|
||||
|
||||
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate, XPRoomNewUserGreetViewDelegate, XPWishGiftViewControllerDelegate>
|
||||
///host 代理
|
||||
@@ -115,6 +116,8 @@
|
||||
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
|
||||
///跨房PK预约倒计时
|
||||
@property (nonatomic, strong) XPAcrossRoomPKCountDownView *acrossPKCountView;
|
||||
///个播PK匹配
|
||||
@property (nonatomic, strong) XPAnchorPKMatchView *anchorPKMatchView;
|
||||
///小游戏 最小化的坑位
|
||||
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
|
||||
///显示游戏的切换
|
||||
@@ -169,7 +172,7 @@
|
||||
self.delegate = delegate;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginMatchAnchorPK) name:@"anchorPKMatchBegin" object:nil];
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(beginMatchAnchorPK:) name:@"anchorPKMatchBegin" object:nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -455,8 +458,23 @@
|
||||
}
|
||||
|
||||
#pragma mark - 个播PK
|
||||
- (void)beginMatchAnchorPK {
|
||||
|
||||
- (void)beginMatchAnchorPK:(NSNotification *)noti {
|
||||
if (!self.anchorPKMatchView.superview) {
|
||||
[self addSubview:self.anchorPKMatchView];
|
||||
self.anchorPKMatchView.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||
[self.anchorPKMatchView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(5+37+5);
|
||||
make.left.mas_equalTo(0);
|
||||
make.width.height.mas_equalTo(52);
|
||||
}];
|
||||
NSDictionary *dict = noti.object;
|
||||
NSNumber *startTime = dict[@"matchPkStartTime"];
|
||||
self.delegate.getRoomInfo.pkMatchStartTime = [startTime longLongValue];
|
||||
NSDate *datenow = [NSDate date];
|
||||
long time2 = (long)([datenow timeIntervalSince1970]*1000);
|
||||
long aTime = (time2 - self.delegate.getRoomInfo.pkMatchStartTime) / 1000;
|
||||
[self.anchorPKMatchView openCountdownWithTime:aTime];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - RoomGuestDelegate
|
||||
@@ -604,6 +622,8 @@
|
||||
[self handleNewUserRoomGift];
|
||||
///房间心愿礼物
|
||||
[self configWishGiftEnter];
|
||||
///随机PK匹配
|
||||
[self handleMatchAnchorPK];
|
||||
}
|
||||
|
||||
- (void)onRoomMiniEntered {
|
||||
@@ -776,6 +796,7 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AnchorPK_Accept://对方接受个播PK邀请
|
||||
{
|
||||
[self.anchorPKMatchView removeFromSuperview];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
request.userIds = @[[AccountInfoStorage instance].getUid];
|
||||
@@ -829,6 +850,7 @@
|
||||
break;
|
||||
case Custom_Message_Sub_AnchorPK_Panel://个播PK面板消息
|
||||
{
|
||||
[self.anchorPKMatchView removeFromSuperview];
|
||||
if (!self.anchorPKPanelView.superview) {
|
||||
[self addSubview:self.anchorPKPanelView];
|
||||
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -876,6 +898,18 @@
|
||||
case Custom_Message_Sub_PK_BeginTime:{
|
||||
long long time = [attachment.data[@"beginTime"] longLongValue];
|
||||
[self showAcrossPkCountDownViewWithTime:time];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Sub_AnchorPK_Match_TimeOut:
|
||||
{///PK匹配超时
|
||||
self.delegate.getRoomInfo.pkMatchStartTime = nil;
|
||||
self.anchorPKMatchView.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||
[self.anchorPKMatchView handleMatchTimeOutMessage];
|
||||
}
|
||||
break;
|
||||
case Custom_Message_Sub_AnchorPK_MuteOtherMic:///PK时禁用对方麦克风
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -1771,6 +1805,23 @@
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - 随机PK匹配
|
||||
- (void)handleMatchAnchorPK {
|
||||
if (self.delegate.getRoomInfo.pkMatchStartTime) {
|
||||
[self addSubview:self.anchorPKMatchView];
|
||||
self.anchorPKMatchView.roomUid = [NSString stringWithFormat:@"%ld", [self.delegate getRoomInfo].uid];
|
||||
[self.anchorPKMatchView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.contributeEnterView.mas_bottom).mas_offset(5+37+5);
|
||||
make.left.mas_equalTo(0);
|
||||
make.width.height.mas_equalTo(52);
|
||||
}];
|
||||
NSDate *datenow = [NSDate date];
|
||||
long time2 = (long)([datenow timeIntervalSince1970]*1000);
|
||||
long aTime = (time2 - self.delegate.getRoomInfo.pkMatchStartTime) / 1000;
|
||||
[self.anchorPKMatchView openCountdownWithTime:aTime];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (XPRoomRankEntranceView *)contributeEnterView {
|
||||
if (!_contributeEnterView) {
|
||||
@@ -1933,6 +1984,13 @@
|
||||
return _acrossPKCountView;
|
||||
}
|
||||
|
||||
- (XPAnchorPKMatchView *)anchorPKMatchView {
|
||||
if (!_anchorPKMatchView) {
|
||||
_anchorPKMatchView = [[XPAnchorPKMatchView alloc] initWithDelegate:self.delegate];
|
||||
}
|
||||
return _anchorPKMatchView;
|
||||
}
|
||||
|
||||
- (XPWishGiftEnterView *)wishGiftView {
|
||||
if (!_wishGiftView) {
|
||||
_wishGiftView = [[XPWishGiftEnterView alloc] init];
|
||||
|
Reference in New Issue
Block a user