PK面板麦序的显示
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#import "RtcManager.h"
|
||||
#import "XPRoomMiniManager.h"
|
||||
#import "Api+RoomPK.h"
|
||||
#import "XPGiftStorage.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "MicroQueueModel.h"
|
||||
@@ -42,6 +43,9 @@
|
||||
#import "AcrossRoomPKPanelModel.h"
|
||||
#import "RoomPKDetailInfoModel.h"
|
||||
#import "RoomPKChooseUserModel.h"
|
||||
#import "GiftReceiveInfoModel.h"
|
||||
#import "GiftInfoModel.h"
|
||||
#import "RoomPKTeamModel.h"
|
||||
///View
|
||||
#import "XPRoomHalfWebView.h"
|
||||
#import "XPAnchorAudienceUpMicView.h"
|
||||
@@ -118,6 +122,18 @@
|
||||
@property (nonatomic,strong) XPRoomPKProgressView *roompkPanelView;
|
||||
///房间PK信息
|
||||
@property (nonatomic,strong) RoomPKDetailInfoModel *pkDetailInfo;
|
||||
///红队按礼物价值计算的话分数
|
||||
@property (nonatomic,assign) CGFloat redTeamValueScore;
|
||||
///蓝队总的分数按礼物价值计算的话分数
|
||||
@property (nonatomic,assign) CGFloat blueTeamValueScore;
|
||||
///红队收到礼物个数(按照收礼个数)
|
||||
@property (nonatomic, strong) NSMutableSet * redTeamGiftPersonDic;
|
||||
///蓝队收到礼物个数(按照收礼个数)
|
||||
@property (nonatomic, strong) NSMutableSet * blueTeamGiftPersonDic;
|
||||
///红队的人员
|
||||
@property (nonatomic,strong) NSArray *redUserArray;
|
||||
///蓝队的人员
|
||||
@property (nonatomic,strong) NSArray *blueUserArray;
|
||||
@end
|
||||
|
||||
@implementation XPRoomFunctionContainerView
|
||||
@@ -323,6 +339,15 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (MicroQueueModel *)findMicroInfoByUid:(NSString *)uid {
|
||||
for (MicroQueueModel *model in self.delegate.getMicroQueue.allValues) {
|
||||
if (model.userInfo && model.userInfo.uid == uid.intValue) {
|
||||
return model;
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)getRoomPKDetailInfo {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||
@@ -331,34 +356,68 @@
|
||||
RoomPKDetailInfoModel * pkDetailInfo = [RoomPKDetailInfoModel modelWithDictionary:data.data];
|
||||
self.pkDetailInfo = pkDetailInfo;
|
||||
self.roompkPanelView.pkDetailInfo = pkDetailInfo;
|
||||
if (self.pkDetailInfo.roomPK.pkStatus != RoomPKStatusType_Playing) {
|
||||
[self.roompkPanelView startRoomPKCountDown:(pkDetailInfo.roomPK.endTime - pkDetailInfo.now) / 1000];
|
||||
NSMutableDictionary * queue = self.delegate.getMicroQueue;
|
||||
///配置一下麦序的信息
|
||||
NSMutableArray * redArray = [NSMutableArray array];
|
||||
NSMutableArray * blueArray = [NSMutableArray array];
|
||||
NSMutableDictionary * queue = self.delegate.getMicroQueue;
|
||||
if (pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_Playing) {
|
||||
for (int i = 0; i < pkDetailInfo.roomPK.teams.count; i++) {
|
||||
RoomPKTeamModel * teamInfo = [pkDetailInfo.roomPK.teams objectAtIndex:i];
|
||||
if (teamInfo.team == GroupTyp_Red) {
|
||||
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
||||
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
||||
RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
redInfo.avatar = teamUserModel.avatar;
|
||||
redInfo.uid = teamUserModel.uid;
|
||||
redInfo.groupType = GroupTyp_Red;
|
||||
redInfo.position = [self findMicroInfoByUid:teamUserModel.uid].microState.position;
|
||||
redInfo.nick = teamUserModel.nick;
|
||||
[redArray addObject:redInfo];
|
||||
}
|
||||
} else if(teamInfo.team == GroupType_Blue) {
|
||||
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
||||
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
||||
RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
blueInfo.avatar = teamUserModel.avatar;
|
||||
blueInfo.uid = teamUserModel.uid;
|
||||
blueInfo.groupType = GroupType_Blue;
|
||||
blueInfo.position = [self findMicroInfoByUid:teamUserModel.uid].microState.position;
|
||||
blueInfo.nick = teamUserModel.nick;
|
||||
[blueArray addObject:blueInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int i = 0 ; i < queue.allValues.count; i++) {
|
||||
MicroQueueModel * micModel = [queue.allValues objectAtIndex:i];
|
||||
if (micModel.userInfo && micModel.userInfo.uid > 0) {
|
||||
UserInfoModel * userInfo = micModel.userInfo;
|
||||
if (userInfo.groupType == GroupTyp_Red) {
|
||||
RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
redInfo.userUrl = userInfo.avatar;
|
||||
redInfo.avatar = userInfo.avatar;
|
||||
redInfo.uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
redInfo.groupType = userInfo.groupType;
|
||||
redInfo.position = micModel.microState.position;
|
||||
redInfo.nick = userInfo.nick;
|
||||
[redArray addObject:redInfo];
|
||||
} else if(userInfo.groupType == GroupType_Blue) {
|
||||
RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
blueInfo.userUrl = userInfo.avatar;
|
||||
blueInfo.avatar = userInfo.avatar;
|
||||
blueInfo.uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
blueInfo.groupType = userInfo.groupType;
|
||||
blueInfo.position = micModel.microState.position;
|
||||
blueInfo.nick = userInfo.nick;
|
||||
[blueArray addObject:blueInfo];
|
||||
}
|
||||
}
|
||||
}
|
||||
self.roompkPanelView.redChooseArray = redArray.copy;
|
||||
self.roompkPanelView.blueChooseArray = blueArray.copy;
|
||||
|
||||
}
|
||||
self.redUserArray = redArray.copy;
|
||||
self.blueUserArray = blueArray.copy;
|
||||
self.roompkPanelView.redChooseArray = self.redUserArray;
|
||||
self.roompkPanelView.blueChooseArray = self.blueUserArray;
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
@@ -366,6 +425,142 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)roomPKReceiveGift:(AttachmentModel *)attachment {
|
||||
if (self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode && self.pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_Playing) {
|
||||
GiftReceiveInfoModel *giftReceiveInfo = [GiftReceiveInfoModel modelWithJSON:attachment.data];
|
||||
GiftInfoModel *giftInfo = giftReceiveInfo.gift == nil ? giftReceiveInfo.giftInfo : giftReceiveInfo.gift;
|
||||
if (giftInfo == nil) {
|
||||
giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:giftReceiveInfo.giftId];
|
||||
}
|
||||
if (attachment.first == CustomMessageType_AllMicroSend) {
|
||||
if (attachment.second == Custom_Message_Sub_AllBatchSend || attachment.second == Custom_Message_Sub_AllMicroSend) {///普通礼物
|
||||
if (self.pkDetailInfo.roomPK.voteMode == RoomPKVoteModeType_NumberPerson) { // 按送礼人数计算
|
||||
NSArray *targetUids = [giftReceiveInfo.targetUsers valueForKeyPath:@"uid"];
|
||||
[self canculeRoomPKSendGiftNumPerson:targetUids];
|
||||
} else {
|
||||
[self canculeRoomGiftValueReceiveInfo:giftReceiveInfo giftPrice:giftInfo.goldPrice giftNumber:giftReceiveInfo.giftNum];
|
||||
}
|
||||
} else if(attachment.second == Custom_Message_Sub_AllMicroLuckySend || attachment.second == Custom_Message_Sub_AllBatchMicroLuckySend) {///福袋礼物
|
||||
if (giftReceiveInfo.luckyGiftList) {
|
||||
__block NSInteger goldPrice = 0;
|
||||
[giftReceiveInfo.luckyGiftList.giftList enumerateObjectsUsingBlock:^(GiftListsInfo * _Nonnull giftListInfo, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
GiftInfoModel *giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:[NSString stringWithFormat:@"%ld", giftListInfo.giftId]];
|
||||
goldPrice += giftInfo.goldPrice * giftListInfo.giftNum;
|
||||
}];
|
||||
if (self.pkDetailInfo.roomPK.voteMode == RoomPKVoteModeType_NumberPerson) { // 按送礼人数计算
|
||||
NSArray *targetUids = @[giftReceiveInfo.targetUid];
|
||||
[self canculeRoomPKSendGiftNumPerson:targetUids];
|
||||
} else {
|
||||
[self canculeRoomGiftValueReceiveInfo:giftReceiveInfo giftPrice:goldPrice giftNumber:1];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(attachment.first == CustomMessageType_Gift) {
|
||||
if (attachment.second == Custom_Message_Sub_Gift_LuckySend) {
|
||||
__block NSInteger goldPrice = 0;
|
||||
[giftReceiveInfo.luckyGiftList.giftList enumerateObjectsUsingBlock:^(GiftListsInfo * _Nonnull giftListInfo, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
GiftInfoModel *giftInfo = [[XPGiftStorage shareStorage] findGiftInfo:[NSString stringWithFormat:@"%ld", giftListInfo.giftId]];
|
||||
goldPrice += giftInfo.goldPrice * giftListInfo.giftNum;
|
||||
}];
|
||||
if (self.pkDetailInfo.roomPK.voteMode == RoomPKVoteModeType_NumberPerson) { // 按送礼人数计算
|
||||
NSArray *targetUids = @[[NSString stringWithFormat:@"%ld", giftReceiveInfo.luckyGiftList.user.uid]];
|
||||
[self canculeRoomPKSendGiftNumPerson:targetUids];
|
||||
} else {
|
||||
[self canculeRoomGiftValueReceiveInfo:giftReceiveInfo giftPrice:goldPrice giftNumber:giftReceiveInfo.giftNum];
|
||||
}
|
||||
} else {
|
||||
if (self.pkDetailInfo.roomPK.voteMode == RoomPKVoteModeType_NumberPerson) { // 按送礼人数计算
|
||||
NSArray *targetUids = @[giftReceiveInfo.targetUid];
|
||||
[self canculeRoomPKSendGiftNumPerson:targetUids];
|
||||
} else {
|
||||
[self canculeRoomGiftValueReceiveInfo:giftReceiveInfo giftPrice:giftInfo.goldPrice giftNumber:giftReceiveInfo.giftNum];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
- (void)canculeRoomGiftValueReceiveInfo:(GiftReceiveInfoModel *)giftReceiveInfo giftPrice:(NSInteger)giftPrice giftNumber:(NSInteger)giftNumber {
|
||||
//是不是全麦送礼
|
||||
if (giftReceiveInfo.targetUids.count > 0) {
|
||||
for (RoomPKChooseUserModel * userInfo in self.redUserArray) {
|
||||
for (NSString * uid in giftReceiveInfo.targetUids) {
|
||||
if (uid.integerValue == userInfo.uid.integerValue) {
|
||||
self.redTeamValueScore += (giftPrice * giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (giftReceiveInfo.targetUsers.count > 0){//多选
|
||||
NSArray *targetUids = [giftReceiveInfo.targetUsers valueForKeyPath:@"uid"];
|
||||
for (RoomPKChooseUserModel * userInfo in self.redUserArray) {
|
||||
for (NSString * uid in targetUids) {
|
||||
if (uid.integerValue == userInfo.uid.integerValue) {
|
||||
self.redTeamValueScore += (giftPrice * giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (RoomPKChooseUserModel * userInfo in self.redUserArray) {
|
||||
if (userInfo.uid.integerValue == giftReceiveInfo.targetUid.integerValue) {
|
||||
self.redTeamValueScore += (giftPrice *giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//是不是全麦
|
||||
if (giftReceiveInfo.targetUids.count > 0) {
|
||||
for (RoomPKChooseUserModel * infor in self.blueUserArray) {
|
||||
for (NSString * uid in giftReceiveInfo.targetUids) {
|
||||
if (uid.integerValue == infor.uid.integerValue) {
|
||||
self.blueTeamValueScore += (giftPrice * giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (giftReceiveInfo.targetUsers.count > 0){//多选
|
||||
NSArray *targetUids = [giftReceiveInfo.targetUsers valueForKeyPath:@"uid"];
|
||||
for (RoomPKChooseUserModel * infor in self.blueUserArray) {
|
||||
for (NSString * uid in targetUids) {
|
||||
if (uid.integerValue == infor.uid.integerValue) {
|
||||
self.blueTeamValueScore += (giftPrice * giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for (RoomPKChooseUserModel * infor in self.blueUserArray) {
|
||||
if (infor.uid.integerValue == giftReceiveInfo.targetUid.integerValue) {
|
||||
self.blueTeamValueScore += (giftPrice * giftNumber);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
[self.roompkPanelView configRedTeamScore:self.redTeamValueScore blueTeamScore:self.blueTeamValueScore];
|
||||
}
|
||||
|
||||
- (void)canculeRoomPKSendGiftNumPerson:(NSArray *)sendGiftUses {
|
||||
for (NSString * uid in sendGiftUses) {
|
||||
for (int i = 0; i < self.redUserArray.count; i++) {
|
||||
RoomPKChooseUserModel * redUserInfo = [self.redUserArray objectAtIndex:i];
|
||||
if (uid.integerValue == redUserInfo.uid.integerValue) {
|
||||
[self.redTeamGiftPersonDic addObject:uid];
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < self.blueUserArray.count; i++) {
|
||||
RoomPKChooseUserModel * redUserInfo = [self.blueUserArray objectAtIndex:i];
|
||||
if (uid.integerValue == redUserInfo.uid.integerValue) {
|
||||
[self.blueTeamGiftPersonDic addObject:uid];
|
||||
}
|
||||
}
|
||||
}
|
||||
[self.roompkPanelView configRedTeamScore:self.redTeamGiftPersonDic.count blueTeamScore:self.blueTeamGiftPersonDic.count];
|
||||
}
|
||||
|
||||
#pragma mark - RoomGuestDelegate
|
||||
- (void)onRoomUpdate {
|
||||
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
|
||||
@@ -514,14 +709,16 @@
|
||||
AttachmentModel *attachment = (AttachmentModel *)obj.attachment;
|
||||
if (attachment.first == CustomMessageType_AnchorRoom_AudienceUpMic) {
|
||||
[self showAskForUpMic:attachment.data];
|
||||
} 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)) {
|
||||
[self roomPKReceiveGift:attachment];
|
||||
}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)) {
|
||||
[self roomPKReceiveGift:attachment];
|
||||
} else if(attachment.first == CustomMessageType_Room_PK) {
|
||||
if (attachment.second == Custom_Message_Sub_Room_PK_Start) {
|
||||
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
||||
self.pkDetailInfo.roomPK = pkInfo;
|
||||
self.roompkPanelView.pkDetailInfo = self.pkDetailInfo;
|
||||
[self.roompkPanelView startRoomPKCountDown:pkInfo.duration];
|
||||
if (pkInfo.pkStatus == RoomPKStatusType_Playing) {
|
||||
//TODO: 弹框显示Pk
|
||||
}
|
||||
}else if (attachment.second == Custom_Message_Sub_Room_PK_Mode_Open){
|
||||
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
||||
self.pkDetailInfo.roomPK = pkInfo;
|
||||
@@ -534,10 +731,14 @@
|
||||
[self.roompkPanelView stopRoomPKCountDown];
|
||||
if (pkInfo.pkStatus == RoomPKStatusType_ReStart) {///重新开始了 需要重新赋值
|
||||
self.pkDetailInfo.roomPK = pkInfo;
|
||||
self.roompkPanelView.pkDetailInfo = self.pkDetailInfo;
|
||||
} else {
|
||||
if (pkInfo.pkId == self.pkDetailInfo.roomPK.pkId) {
|
||||
self.pkDetailInfo.roomPK = pkInfo;
|
||||
self.roompkPanelView.pkDetailInfo = self.pkDetailInfo;
|
||||
//TODO: 更新自己的麦序结果
|
||||
} else {
|
||||
[self.roompkPanelView clearRoomPKTeamData];
|
||||
}
|
||||
}
|
||||
} else if(attachment.second == Custom_Message_Sub_Room_PK_Mode_Close) {
|
||||
@@ -833,14 +1034,16 @@
|
||||
UserInfoModel * userInfo = micModel.userInfo;
|
||||
if (userInfo.groupType == GroupTyp_Red) {
|
||||
RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
redInfo.userUrl = userInfo.avatar;
|
||||
redInfo.avatar = userInfo.avatar;
|
||||
redInfo.uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
redInfo.nick = userInfo.nick;
|
||||
redInfo.groupType = userInfo.groupType;
|
||||
redInfo.position = micModel.microState.position;
|
||||
[redArray addObject:redInfo];
|
||||
} else if(userInfo.groupType == GroupType_Blue) {
|
||||
RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init];
|
||||
blueInfo.userUrl = userInfo.avatar;
|
||||
blueInfo.avatar = userInfo.avatar;
|
||||
blueInfo.nick = userInfo.nick;
|
||||
blueInfo.uid = [NSString stringWithFormat:@"%ld", userInfo.uid];
|
||||
blueInfo.groupType = userInfo.groupType;
|
||||
blueInfo.position = micModel.microState.position;
|
||||
@@ -848,8 +1051,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
self.roompkPanelView.redChooseArray = redArray.copy;
|
||||
self.roompkPanelView.blueChooseArray = blueArray.copy;
|
||||
self.redUserArray = redArray.copy;
|
||||
self.blueUserArray = blueArray.copy;
|
||||
self.roompkPanelView.redChooseArray = self.redUserArray;
|
||||
self.roompkPanelView.blueChooseArray = self.blueUserArray;
|
||||
}
|
||||
} else {
|
||||
[self getRoomPKDetailInfo];
|
||||
|
@@ -293,17 +293,17 @@
|
||||
victoryStr = @"平局";
|
||||
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, resultScale];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor mainTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||
}else{
|
||||
if (team.protecScore > 0) {
|
||||
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
||||
victoryStr = @"平局";
|
||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, resultScale];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor mainTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||
}else{
|
||||
victoryStr = @"平局";
|
||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, @"0:0"];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor mainTextColor] font:kRoomMessageDefalutFont]];
|
||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||
}
|
||||
}
|
||||
}else{
|
||||
|
@@ -23,7 +23,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///图片的名称
|
||||
@property (nonatomic,copy) NSString *imageName;
|
||||
///用户的头像
|
||||
@property (nonatomic,copy) NSString *userUrl;
|
||||
@property (nonatomic,copy) NSString *avatar;
|
||||
///是否选中了
|
||||
@property (nonatomic,assign) BOOL isSelect;
|
||||
///是否可选
|
||||
|
@@ -44,20 +44,6 @@ typedef NS_ENUM(NSInteger,RoomPKStatusType){
|
||||
@property (nonatomic, copy) NSDictionary<NSString *, NSDictionary<NSString *, NSArray<NSString *> *> *> *sendGiftUids;
|
||||
///参与PK的队伍
|
||||
@property (nonatomic, strong) NSArray<RoomPKTeamModel *> * teams;
|
||||
///本地字段
|
||||
///红队的人员
|
||||
@property (nonatomic,strong) NSArray *redUserArray;
|
||||
///蓝队的人员
|
||||
@property (nonatomic,strong) NSArray *blueUserArray;
|
||||
///红队按礼物价值计算的话分数
|
||||
@property (nonatomic,assign) CGFloat redTeamValueScore;
|
||||
///蓝队总的分数按礼物价值计算的话分数
|
||||
@property (nonatomic,assign) CGFloat blueTeamValueScore;
|
||||
///红队收到礼物个数(按照收礼个数)
|
||||
@property (nonatomic, strong) NSMutableSet * redTeamGiftPersonDic;
|
||||
///蓝队收到礼物个数(按照收礼个数)
|
||||
@property (nonatomic, strong) NSMutableSet * blueTeamGiftPersonDic;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -71,8 +71,8 @@
|
||||
_ownerAvatarImageView.image = [UIImage imageNamed:_userInfo.imageName];
|
||||
}
|
||||
|
||||
if (_userInfo.userUrl) {
|
||||
_ownerAvatarImageView.imageUrl = _userInfo.userUrl;
|
||||
if (_userInfo.avatar) {
|
||||
_ownerAvatarImageView.imageUrl = _userInfo.avatar;
|
||||
}
|
||||
self.ownerLabel.text = _userInfo.title;
|
||||
|
||||
|
@@ -15,6 +15,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@end
|
||||
@interface XPRoomPKPanelUserView : UIView
|
||||
///是否展示添加的按钮
|
||||
@property (nonatomic,assign) BOOL isShowAdd;
|
||||
///高度
|
||||
@property (nonatomic,assign) CGFloat itemHeight;
|
||||
@property (nonatomic,assign) GroupType type;
|
||||
|
@@ -49,6 +49,7 @@
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.isShowAdd = YES;
|
||||
self.itemHeight = 25;
|
||||
[self addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.addButton];
|
||||
@@ -103,7 +104,7 @@
|
||||
if (i < self.userArray.count) {
|
||||
RoomPKChooseUserModel * userInfo = [self.userArray objectAtIndex:i];
|
||||
view.hidden = NO;
|
||||
view.imageUrl = userInfo.userUrl;
|
||||
view.imageUrl = userInfo.avatar;
|
||||
} else {
|
||||
view.hidden = YES;
|
||||
}
|
||||
@@ -114,7 +115,7 @@
|
||||
}];
|
||||
} else {
|
||||
self.userView.hidden = YES;
|
||||
self.addButton.hidden = NO;
|
||||
self.addButton.hidden = self.isShowAdd ? NO : YES;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -195,6 +196,16 @@
|
||||
[self mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(self.itemHeight);
|
||||
}];
|
||||
self.firstUserView.layer.cornerRadius = _itemHeight / 2;
|
||||
self.secondUserView.layer.cornerRadius = _itemHeight / 2;
|
||||
self.thirdUserView.layer.cornerRadius = _itemHeight / 2;
|
||||
self.fourthUserView.layer.cornerRadius = _itemHeight / 2;
|
||||
self.fifthUserView.layer.cornerRadius = _itemHeight / 2;
|
||||
}
|
||||
|
||||
- (void)setIsShowAdd:(BOOL)isShowAdd {
|
||||
_isShowAdd = isShowAdd;
|
||||
self.addButton.hidden = !_isShowAdd;
|
||||
}
|
||||
|
||||
- (UIStackView *)stackView {
|
||||
|
@@ -160,6 +160,7 @@
|
||||
- (void)chooseButtonAction:(UIButton *)sender {
|
||||
if (self.chooseButton.hidden) {return;}
|
||||
sender.selected = !sender.selected;
|
||||
self.ownerUserInfo.isSelect = !self.ownerUserInfo.isSelect;
|
||||
__block RoomPKChooseUserModel * selectModel;
|
||||
[self.chooseArray enumerateObjectsUsingBlock:^(RoomPKChooseUserModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.uid == self.ownerUserInfo.uid) {
|
||||
@@ -167,10 +168,11 @@
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (selectModel) {
|
||||
[self.chooseArray removeObject:selectModel];
|
||||
if (selectModel && !self.ownerUserInfo.isSelect) {
|
||||
selectModel.groupType = GroupType_default;
|
||||
}
|
||||
if (sender.selected) {
|
||||
|
||||
if (self.ownerUserInfo.isSelect && selectModel == nil) {
|
||||
[self.chooseArray addObject:self.ownerUserInfo];
|
||||
}
|
||||
}
|
||||
@@ -178,6 +180,7 @@
|
||||
- (void)didTapRecognizer:(UITapGestureRecognizer *)tap {
|
||||
if (self.chooseButton.hidden) {return;}
|
||||
self.chooseButton.selected = !self.chooseButton.selected;
|
||||
self.ownerUserInfo.isSelect = !self.ownerUserInfo.isSelect;
|
||||
__block RoomPKChooseUserModel * selectModel;
|
||||
[self.chooseArray enumerateObjectsUsingBlock:^(RoomPKChooseUserModel * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||
if (obj.uid == self.ownerUserInfo.uid) {
|
||||
@@ -185,10 +188,11 @@
|
||||
*stop = YES;
|
||||
}
|
||||
}];
|
||||
if (selectModel) {
|
||||
[self.chooseArray removeObject:selectModel];
|
||||
if (selectModel && !self.ownerUserInfo.isSelect) {
|
||||
selectModel.groupType = GroupType_default;
|
||||
}
|
||||
if (self.chooseButton.selected) {
|
||||
|
||||
if (self.ownerUserInfo.isSelect && selectModel == nil) {
|
||||
[self.chooseArray addObject:self.ownerUserInfo];
|
||||
}
|
||||
}
|
||||
@@ -213,9 +217,9 @@
|
||||
|
||||
RoomPKChooseUserModel * userInfoModel = [self.userPositionArray objectAtIndex:position];
|
||||
userInfoModel.title = microModel.userInfo.nick;
|
||||
userInfoModel.userUrl = microModel.userInfo.avatar;
|
||||
userInfoModel.avatar = microModel.userInfo.avatar;
|
||||
userInfoModel.uid = [NSString stringWithFormat:@"%ld", microModel.userInfo.uid];
|
||||
userInfoModel.position = microModel.microState.position;
|
||||
userInfoModel.position = position;
|
||||
userInfoModel.nick = microModel.userInfo.nick;
|
||||
userInfoModel.groupType = self.groupType;
|
||||
userInfoModel.isEnableChoose = YES;
|
||||
@@ -225,7 +229,6 @@
|
||||
if (userInfoModel.uid.integerValue == redInfoModel.uid.integerValue) {
|
||||
userInfoModel.isSelect = YES;
|
||||
}
|
||||
redInfoModel.position = position;
|
||||
}
|
||||
|
||||
for (int i = 0; i<self.blueUserArray.count; i++) {
|
||||
@@ -233,7 +236,6 @@
|
||||
if (userInfoModel.uid.integerValue == blueInfoModel.uid.integerValue) {
|
||||
userInfoModel.isEnableChoose = NO;
|
||||
}
|
||||
blueInfoModel.position = position;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i<self.blueUserArray.count; i++) {
|
||||
@@ -241,7 +243,6 @@
|
||||
if (userInfoModel.uid.integerValue == blueInfoModel.uid.integerValue) {
|
||||
userInfoModel.isSelect = YES;
|
||||
}
|
||||
blueInfoModel.position = position;
|
||||
}
|
||||
|
||||
for (int i = 0; i<self.redUserArray.count; i++) {
|
||||
@@ -249,7 +250,6 @@
|
||||
if (userInfoModel.uid.integerValue == redInfoModel.uid.integerValue) {
|
||||
userInfoModel.isEnableChoose = NO;
|
||||
}
|
||||
redInfoModel.position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -258,7 +258,7 @@
|
||||
self.ownerAvatarImageView.imageUrl = microModel.userInfo.avatar;
|
||||
self.ownerLabel.text = microModel.userInfo.nick;
|
||||
self.ownerUserInfo.title = microModel.userInfo.nick;
|
||||
self.ownerUserInfo.userUrl = microModel.userInfo.avatar;
|
||||
self.ownerUserInfo.avatar = microModel.userInfo.avatar;
|
||||
self.ownerUserInfo.uid = [NSString stringWithFormat:@"%ld", microModel.userInfo.uid];
|
||||
self.ownerUserInfo.position = microModel.microState.position;
|
||||
self.ownerUserInfo.nick = microModel.userInfo.nick;
|
||||
@@ -270,8 +270,8 @@
|
||||
RoomPKChooseUserModel * redInfoModel = [self.redUserArray objectAtIndex:i];
|
||||
if (self.ownerUserInfo.uid.integerValue == redInfoModel.uid.integerValue) {
|
||||
self.chooseButton.selected = YES;
|
||||
self.ownerUserInfo.isSelect = YES;
|
||||
}
|
||||
redInfoModel.position = position;
|
||||
}
|
||||
|
||||
for (int i = 0; i<self.blueUserArray.count; i++) {
|
||||
@@ -279,15 +279,14 @@
|
||||
if (self.ownerUserInfo.uid.integerValue == blueInfoModel.uid.integerValue) {
|
||||
self.chooseButton.hidden = YES;
|
||||
}
|
||||
blueInfoModel.position = position;
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i<self.blueUserArray.count; i++) {
|
||||
RoomPKChooseUserModel * blueInfoModel = [self.blueUserArray objectAtIndex:i];
|
||||
if (self.ownerUserInfo.uid.integerValue == blueInfoModel.uid.integerValue) {
|
||||
self.chooseButton.selected = YES;
|
||||
self.ownerUserInfo.isSelect = YES;
|
||||
}
|
||||
blueInfoModel.position = position;
|
||||
}
|
||||
|
||||
for (int i = 0; i<self.redUserArray.count; i++) {
|
||||
@@ -295,7 +294,6 @@
|
||||
if (self.ownerUserInfo.uid.integerValue == redInfoModel.uid.integerValue) {
|
||||
self.chooseButton.hidden = YES;
|
||||
}
|
||||
redInfoModel.position = position;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -59,8 +59,8 @@
|
||||
- (void)setUserInfo:(RoomPKChooseUserModel *)userInfo {
|
||||
_userInfo = userInfo;
|
||||
if (_userInfo) {
|
||||
if (_userInfo.userUrl.length > 0) {
|
||||
self.avatarImageView.imageUrl = _userInfo.userUrl;
|
||||
if (_userInfo.avatar.length > 0) {
|
||||
self.avatarImageView.imageUrl = _userInfo.avatar;
|
||||
}
|
||||
if (_userInfo.title.length > 0) {
|
||||
[self.nickButton setTitle:_userInfo.title forState:UIControlStateNormal];
|
||||
|
@@ -8,12 +8,19 @@
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class RoomPKDetailInfoModel;
|
||||
@class RoomPKDetailInfoModel, RoomPKChooseUserModel;
|
||||
@interface XPRoomPKPlayingView : UIView
|
||||
///是否是管理员
|
||||
@property (nonatomic,assign) BOOL isManager;
|
||||
///PK详情
|
||||
@property (nonatomic,strong) RoomPKDetailInfoModel *pkDetailInfo;
|
||||
///红色的
|
||||
@property (nonatomic,strong) NSArray<RoomPKChooseUserModel *> *redChooseArray;
|
||||
///蓝色的
|
||||
@property (nonatomic,strong) NSArray<RoomPKChooseUserModel *> *blueChooseArray;
|
||||
///当前显示的时间
|
||||
@property (nonatomic,copy) NSString *currentTime;
|
||||
- (void)configRedTeamScore:(long)redTeamScore blueTeamScore:(long)blueTeamScore;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -60,6 +60,21 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Public Method
|
||||
- (void)configRedTeamScore:(long)redTeamScore blueTeamScore:(long)blueTeamScore {
|
||||
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
||||
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
||||
if (redTeamScore > 0 || blueTeamScore > 0) {
|
||||
CGFloat redScale = (long)redTeamScore / (long)(redTeamScore + blueTeamScore);
|
||||
if (redScale == 1) {
|
||||
redScale = 0.99;
|
||||
}
|
||||
[self.redProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo((56 + 45) * 2 * redScale);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backImageView];
|
||||
@@ -73,6 +88,7 @@
|
||||
[self.backImageView addSubview:self.beginButton];
|
||||
[self.backImageView addSubview:self.voteModeLabel];
|
||||
[self.backImageView addSubview:self.pkLabel];
|
||||
[self.backImageView addSubview:self.foldButton];
|
||||
|
||||
[self.progressView addSubview:self.redProgressView];
|
||||
[self.progressView addSubview:self.blueProgressView];
|
||||
@@ -96,7 +112,7 @@
|
||||
|
||||
[self.redTeamView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(self.backImageView.mas_centerX).offset(-56);
|
||||
make.centerY.mas_equalTo(self.backImageView).offset(25);
|
||||
make.top.mas_equalTo(self.backImageView).offset(25);
|
||||
}];
|
||||
|
||||
[self.voteModeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -118,12 +134,12 @@
|
||||
make.width.mas_equalTo(56 * 2 + 45 * 2);
|
||||
make.height.mas_equalTo(7);
|
||||
make.centerX.mas_equalTo(self.backImageView);
|
||||
make.top.mas_equalTo(self.redTeamView.mas_bottom).offset(13);
|
||||
make.top.mas_equalTo(self.redTeamView.mas_bottom).offset(23);
|
||||
}];
|
||||
|
||||
[self.redProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.top.bottom.mas_equalTo(self.progressView);
|
||||
make.width.mas_equalTo(85);
|
||||
make.width.mas_equalTo(56 + 45);
|
||||
}];
|
||||
|
||||
[self.blueProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -152,6 +168,13 @@
|
||||
make.centerX.mas_equalTo(self.backImageView);
|
||||
make.bottom.mas_equalTo(self.backImageView.mas_bottom).offset(-15);
|
||||
}];
|
||||
|
||||
[self.foldButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(0);
|
||||
make.right.mas_equalTo(0);
|
||||
make.width.mas_equalTo(30.5);
|
||||
make.height.mas_equalTo(17.5);
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
@@ -177,17 +200,23 @@
|
||||
_pkDetailInfo = pkDetailInfo;
|
||||
if (_pkDetailInfo) {
|
||||
RoomPKInfoModel * infoModel = pkDetailInfo.roomPK;
|
||||
if (infoModel.teams.count > 0) {
|
||||
NSMutableArray * redArray = [NSMutableArray array];
|
||||
NSMutableArray * blueArray = [NSMutableArray array];
|
||||
for (int i = 0; i < infoModel.teams.count; i++) {
|
||||
RoomPKTeamModel * teamInfo = [infoModel.teams objectAtIndex:i];
|
||||
if (infoModel.pkStatus == RoomPKStatusType_End || infoModel.pkStatus == RoomPKStatusType_NonStart) {
|
||||
self.voteModeLabel.text = _pkDetailInfo.roomPK.voteMode == RoomPKVoteModeType_GiftValue ? @"按礼物价值" : @"按送礼人数";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)setCurrentTime:(NSString *)currentTime {
|
||||
_currentTime = currentTime;
|
||||
self.timeLabel.text = _currentTime;
|
||||
}
|
||||
|
||||
- (void)setRedChooseArray:(NSArray *)redChooseArray {
|
||||
_redChooseArray = redChooseArray;
|
||||
self.redTeamView.userArray = _redChooseArray;
|
||||
}
|
||||
|
||||
- (void)setBlueChooseArray:(NSArray *)blueChooseArray {
|
||||
_blueChooseArray = blueChooseArray;
|
||||
self.blueTeamView.userArray = _blueChooseArray;
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
@@ -235,8 +264,9 @@
|
||||
- (XPRoomPKPanelUserView *)redTeamView {
|
||||
if (!_redTeamView) {
|
||||
_redTeamView = [[XPRoomPKPanelUserView alloc] init];
|
||||
_redTeamView.type = GroupTyp_Red;
|
||||
_redTeamView.itemHeight = 45;
|
||||
_redTeamView.isShowAdd = NO;
|
||||
_redTeamView.type = GroupTyp_Red;
|
||||
}
|
||||
return _redTeamView;
|
||||
}
|
||||
@@ -244,8 +274,9 @@
|
||||
- (XPRoomPKPanelUserView *)blueTeamView {
|
||||
if (!_blueTeamView) {
|
||||
_blueTeamView = [[XPRoomPKPanelUserView alloc] init];
|
||||
_blueTeamView.type = GroupType_Blue;
|
||||
_blueTeamView.itemHeight = 45;
|
||||
_blueTeamView.isShowAdd = NO;
|
||||
_blueTeamView.type = GroupType_Blue;
|
||||
}
|
||||
return _blueTeamView;
|
||||
}
|
||||
@@ -254,6 +285,8 @@
|
||||
if (!_progressView) {
|
||||
_progressView = [[UIView alloc] init];
|
||||
_progressView.backgroundColor = [UIColor clearColor];
|
||||
_progressView.layer.masksToBounds = YES;
|
||||
_progressView.layer.cornerRadius = 3.5;
|
||||
}
|
||||
return _progressView;
|
||||
}
|
||||
|
@@ -24,6 +24,11 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (nonatomic,strong) NSArray<RoomPKChooseUserModel *> *blueChooseArray;
|
||||
///是否收到了Pk的结果
|
||||
@property (nonatomic,assign) BOOL isReceivePKResult;
|
||||
///红队的分数
|
||||
@property (nonatomic,assign) long redTeamScore;
|
||||
///蓝队的分数
|
||||
@property (nonatomic,assign) long blueTeamScore;
|
||||
- (void)configRedTeamScore:(long)redTeamScore blueTeamScore:(long)blueTeamScore;
|
||||
///清理数据
|
||||
- (void)clearRoomPKTeamData;
|
||||
///开始倒计时
|
||||
|
@@ -25,6 +25,8 @@
|
||||
///View
|
||||
#import "XPRoomPKPanelUserView.h"
|
||||
#import "XPRoomPKSelectUserView.h"
|
||||
#import "XPRoomPKPlayingView.h"
|
||||
#import "XPRoomPKPlayingView.h"
|
||||
|
||||
@interface XPRoomPKProgressView ()<XPRoomPKPanelUserViewDelegate, XPRoomPKSelectUserViewDelegate>
|
||||
///背景
|
||||
@@ -55,6 +57,8 @@
|
||||
@property (nonatomic,assign) CGFloat currentTime;
|
||||
///检查失败的次数
|
||||
@property (nonatomic,assign) int checkResultNum;
|
||||
///正在pk中的面板
|
||||
@property (nonatomic,strong) XPRoomPKPlayingView *roomPKPlayingView;
|
||||
@end
|
||||
|
||||
|
||||
@@ -75,7 +79,7 @@
|
||||
|
||||
#pragma mark - Public Method
|
||||
- (void)startRoomPKCountDown:(CGFloat)time {
|
||||
__block long tempTime = time - 1; //倒计时时间
|
||||
__block long tempTime = time; //倒计时时间
|
||||
__weak typeof(self) weakSelf = self;
|
||||
self.currentTime = tempTime;
|
||||
if (self.timer != nil) {
|
||||
@@ -100,6 +104,7 @@
|
||||
NSInteger second = (tempTime % 60);
|
||||
NSString *timeStr = [NSString stringWithFormat:@"%02zd:%02zd", minute, second];
|
||||
self.timeLabel.text= timeStr;
|
||||
self.roomPKPlayingView.currentTime = timeStr;
|
||||
});
|
||||
tempTime--;
|
||||
self.currentTime = tempTime;
|
||||
@@ -122,6 +127,22 @@
|
||||
self.blueTeamView.userArray = nil;
|
||||
}
|
||||
|
||||
- (void)configRedTeamScore:(long)redTeamScore blueTeamScore:(long)blueTeamScore {
|
||||
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
||||
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
||||
if (redTeamScore > 0 || blueTeamScore > 0) {
|
||||
CGFloat redScale = (long)redTeamScore / (long)(redTeamScore + blueTeamScore);
|
||||
if (redScale == 1) {
|
||||
redScale = 0.99;
|
||||
}
|
||||
[self.redProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(85 * 2 * redScale);
|
||||
}];
|
||||
}
|
||||
|
||||
[self.roomPKPlayingView configRedTeamScore:redTeamScore blueTeamScore:blueTeamScore];
|
||||
}
|
||||
|
||||
#pragma mark - 查询pk结果的
|
||||
- (void)checkRoomPKResult{
|
||||
if (self.checkResultNum > 2) {
|
||||
@@ -253,6 +274,16 @@
|
||||
|
||||
#pragma mark - XPRoomPKPanelUserViewDelegate
|
||||
- (void)xPRoomPKPanelUserView:(XPRoomPKPanelUserView *)view didClickAddButton:(GroupType)type {
|
||||
|
||||
if (self.pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_Playing) {
|
||||
self.roomPKPlayingView.pkDetailInfo = self.pkDetailInfo;
|
||||
self.roomPKPlayingView.redChooseArray = self.redChooseArray;
|
||||
self.roomPKPlayingView.blueChooseArray = self.blueChooseArray;
|
||||
[self.roomPKPlayingView configRedTeamScore:self.redTeamScore blueTeamScore:self.blueTeamScore];
|
||||
[TTPopup popupView:self.roomPKPlayingView style:TTPopupStyleAlert];
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.isManager) {
|
||||
XPRoomPKSelectUserView * chooseUserView = [[XPRoomPKSelectUserView alloc] init];
|
||||
chooseUserView.delegate = self;
|
||||
@@ -330,7 +361,7 @@
|
||||
|
||||
}];
|
||||
} else if(self.pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_Playing) {
|
||||
//TODO: 展示PK中的面板
|
||||
[self didTapBackImageRecognizer];
|
||||
} else if(self.pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_NonStart) {
|
||||
[TTPopup alertWithMessage:@"当前正在准备阶段,是否确认准备开始PK?" confirmHandler:^{
|
||||
///开始PK
|
||||
@@ -343,7 +374,45 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void)didTapBackImageRecognizer {
|
||||
if (self.pkDetailInfo.roomPK.pkStatus == RoomPKStatusType_Playing) {
|
||||
self.roomPKPlayingView.pkDetailInfo = self.pkDetailInfo;
|
||||
self.roomPKPlayingView.redChooseArray = self.redChooseArray;
|
||||
self.roomPKPlayingView.blueChooseArray = self.blueChooseArray;
|
||||
[self.roomPKPlayingView configRedTeamScore:self.redTeamScore blueTeamScore:self.blueTeamScore];
|
||||
[TTPopup popupView:self.roomPKPlayingView style:TTPopupStyleAlert];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setPkDetailInfo:(RoomPKDetailInfoModel *)pkDetailInfo {
|
||||
_pkDetailInfo = pkDetailInfo;
|
||||
if (_pkDetailInfo) {
|
||||
_beginButton.hidden = NO;
|
||||
switch (_pkDetailInfo.roomPK.pkStatus) {
|
||||
case RoomPKStatusType_End:
|
||||
|
||||
break;
|
||||
case RoomPKStatusType_Playing:
|
||||
{
|
||||
self.beginButton.hidden = YES;
|
||||
self.roomPKPlayingView.pkDetailInfo = self.pkDetailInfo;
|
||||
self.roomPKPlayingView.redChooseArray = self.redChooseArray;
|
||||
self.roomPKPlayingView.blueChooseArray = self.blueChooseArray;
|
||||
[self.roomPKPlayingView configRedTeamScore:self.redTeamScore blueTeamScore:self.blueTeamScore];
|
||||
[TTPopup popupView:self.roomPKPlayingView style:TTPopupStyleAlert];
|
||||
}
|
||||
break;
|
||||
case RoomPKStatusType_ReStart:
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setIsManager:(BOOL)isManager {
|
||||
_isManager = isManager;
|
||||
if (_isManager) {
|
||||
@@ -354,11 +423,13 @@
|
||||
- (void)setRedChooseArray:(NSArray<RoomPKChooseUserModel *> *)redChooseArray {
|
||||
_redChooseArray = redChooseArray;
|
||||
self.redTeamView.userArray = _redChooseArray;
|
||||
self.roomPKPlayingView.redChooseArray = _redChooseArray;
|
||||
}
|
||||
|
||||
- (void)setBlueChooseArray:(NSArray<RoomPKChooseUserModel *> *)blueChooseArray {
|
||||
_blueChooseArray = blueChooseArray;
|
||||
self.blueTeamView.userArray = _blueChooseArray;
|
||||
self.roomPKPlayingView.blueChooseArray = _blueChooseArray;
|
||||
}
|
||||
|
||||
- (UIImageView *)backImageView {
|
||||
@@ -366,6 +437,8 @@
|
||||
_backImageView = [[UIImageView alloc] init];
|
||||
_backImageView.userInteractionEnabled = YES;
|
||||
_backImageView.image = [UIImage imageNamed:@"room_pk_progrss_bg"];
|
||||
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapBackImageRecognizer)];
|
||||
[_backImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _backImageView;
|
||||
}
|
||||
@@ -474,5 +547,12 @@
|
||||
return _beginButton;
|
||||
}
|
||||
|
||||
- (XPRoomPKPlayingView *)roomPKPlayingView {
|
||||
if (!_roomPKPlayingView) {
|
||||
_roomPKPlayingView = [[XPRoomPKPlayingView alloc] init];
|
||||
}
|
||||
return _roomPKPlayingView;
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
Reference in New Issue
Block a user