个播跨房PK面板优化

This commit is contained in:
chenguilong
2022-04-12 18:16:18 +08:00
parent 1bb71681af
commit a84e844df5
42 changed files with 889 additions and 315 deletions

View File

@@ -35,7 +35,7 @@
#import "XPAnchorFansRelationModel.h"
#import "XPAnchorFansJoinModel.h"
#import "XPAnchorFansTaskModel.h"
#import "AnchorPKPanelModel.h"
#import "AcrossRoomPKPanelModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPAnchorAudienceUpMicView.h"
@@ -48,6 +48,8 @@
#import "XPAcrpssRoomPKPanelView.h"
#import "XPAcrossRoomPKResultView.h"
#import "XPAcrossRoomPKForceEndResultView.h"
#import "XPAnchorPKInviteView.h"
#import "XPAnchorPKRuleView.h"
#import "XPSendGiftView.h"
#import "XPUserCardViewController.h"
#import "XPRoomViewController.h"
@@ -323,48 +325,38 @@
if (roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
[Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
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;
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
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);
make.top.mas_equalTo(kNavigationHeight);
}];
}
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;
}
}
// [Api requestEndAnchorRoomPk:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
// NSLog(@"%@", msg);
// } roundId:[NSString stringWithFormat:@"%ld", acrossPKPanelInfo.roundId]];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:roomUid];
} else if (roomInfo.roomModeType == RoomModeType_Open_AnchorPK_Mode) {
[Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
AnchorPKPanelModel * anchorPKPanelInfo = [AnchorPKPanelModel modelWithJSON:data.data];
if (anchorPKPanelInfo.aUid.integerValue > 0) {
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.bottom.mas_equalTo(330);
}];
}
self.anchorPKPanelView.pkPanelInfo = anchorPKPanelInfo;
}
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:roomUid];
} else {
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
make.left.mas_equalTo(0);
}];
}
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
@@ -508,6 +500,7 @@
}
}
break;
///PK
case Custom_Message_Sub_AnchorPK_Invite:
{
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
@@ -517,7 +510,7 @@
if (error == nil) {
NIMChatroomMember * member = [members firstObject];
if (member.type == NIMTeamMemberTypeOwner) {
XPAcrossRoomPKInviteView * inviteView = [[XPAcrossRoomPKInviteView alloc] init];
XPAnchorPKInviteView * inviteView = [[XPAnchorPKInviteView alloc] init];
inviteView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
inviteView.dataDic = attachment.data;
[self addSubview:inviteView];
@@ -582,21 +575,34 @@
break;
case Custom_Message_Sub_AnchorPK_Panel:
{
if (!self.acrossPKPanelView.superview) {
[self addSubview:self.acrossPKPanelView];
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
}];
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
break;
case Custom_Message_Sub_AnchorPK_End:
{
[self.acrossPKPanelView resetAcrossPKViewData];
[self.acrossPKPanelView removeFromSuperview];
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
}];
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
break;
case Custom_Message_Sub_AnchorPK_Finish:
{
[self.anchorPKPanelView resetAcrossPKViewData];
[self.anchorPKPanelView removeFromSuperview];
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
if (model.isForce) {
XPAcrossRoomPKForceEndResultView *view = [[XPAcrossRoomPKForceEndResultView alloc] initWithFrame:CGRectMake(0, 0, 281, 208)];