PK预约倒计时

This commit is contained in:
chenguilong
2022-07-14 18:55:40 +08:00
parent 81a0c20af6
commit fa6b567959
9 changed files with 272 additions and 1 deletions

View File

@@ -74,6 +74,7 @@
#import "XPRoomBackMusicPlayerView.h"
#import "XPRoomNewUserGreetView.h"
#import "XPRoomHalfMessageView.h"
#import "XPAcrossRoomPKCountDownView.h"
///PK
#import "XPAnchorFansTeamEntranceView.h"
#import "XPAnchorFansTeamViewController.h"
@@ -103,6 +104,8 @@
@property (nonatomic,strong) UIButton *editButton;
///pk
@property (nonatomic,strong) XPAcrpssRoomPKPanelView *acrossPKPanelView;
///PK
@property (nonatomic, strong) XPAcrossRoomPKCountDownView *acrossPKCountView;
///
@property (nonatomic,strong) XPLittleGameMiniStageView *littleGameMiniView;
///
@@ -509,7 +512,22 @@
}
} roomUid:roomUid];
}
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;
}];
}
}
[self updateRoomTopic];
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
[self configLittleGameState];
@@ -557,6 +575,8 @@
switch (attachment.second) {
case Custom_Message_Sub_AcrossRoomPK_Invite:
{
[self.acrossPKCountView removeFromSuperview];
self.acrossPKCountView = nil;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
@@ -579,6 +599,8 @@
break;
case Custom_Message_Sub_AcrossRoomPK_Accept:
{
[self.acrossPKCountView removeFromSuperview];
self.acrossPKCountView = nil;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
@@ -604,6 +626,8 @@
break;
case Custom_Message_Sub_AcrossRoomPK_Reject:
{
[self.acrossPKCountView removeFromSuperview];
self.acrossPKCountView = nil;
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
request.userIds = @[[AccountInfoStorage instance].getUid];
@@ -629,6 +653,8 @@
break;
case Custom_Message_Sub_AcrossRoomPK_Panel:
{
[self.acrossPKCountView removeFromSuperview];
self.acrossPKCountView = nil;
if (!self.acrossPKPanelView.superview) {
[self addSubview:self.acrossPKPanelView];
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -642,6 +668,8 @@
break;
case Custom_Message_Sub_AcrossRoomPK_End:
{
[self.acrossPKCountView removeFromSuperview];
self.acrossPKCountView = nil;
[self.acrossPKPanelView resetAcrossPKViewData];
[self.acrossPKPanelView removeFromSuperview];
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
@@ -772,6 +800,11 @@
self.anchorPKPanelView = nil;
[self resetAnchorPkInfo];
[[RtcManager instance] disconnectOtherRoom];
}
break;
case Custom_Message_Sub_PK_BeginTime:{
long long time = [attachment.data[@"beginTime"] longLongValue];
[self showAcrossPkCountDownViewWithTime:time];
}
break;
default:
@@ -1478,6 +1511,32 @@
}
}
///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;
}];
}
#pragma mark - Getters And Setters
- (XPRoomRankEntranceView *)contributeEnterView {
if (!_contributeEnterView) {
@@ -1637,5 +1696,11 @@
return _roompkPanelView;
}
- (XPAcrossRoomPKCountDownView *)acrossPKCountView {
if (!_acrossPKCountView) {
_acrossPKCountView = [[XPAcrossRoomPKCountDownView alloc] initWithFrame:CGRectMake(-130, kNavigationHeight+4+22+4, 130, 34)];
}
return _acrossPKCountView;
}
@end