房间PK结果弹框的UI问题
This commit is contained in:
@@ -18,6 +18,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (Music *)getCurrentMusic;
|
- (Music *)getCurrentMusic;
|
||||||
///是否正在播放
|
///是否正在播放
|
||||||
- (BOOL)isPlaying;
|
- (BOOL)isPlaying;
|
||||||
|
|
||||||
|
///获取房间PK队伍的
|
||||||
|
- (NSArray *)getRoomPKGroupTeamList;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -191,6 +191,20 @@
|
|||||||
return self.musicPlayView.isPlaying;
|
return self.musicPlayView.isPlaying;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (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];
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Private Method
|
#pragma mark - Private Method
|
||||||
- (void)initSubViews {
|
- (void)initSubViews {
|
||||||
[self addSubview:self.contributeEnterView];
|
[self addSubview:self.contributeEnterView];
|
||||||
@@ -759,11 +773,7 @@
|
|||||||
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
if (self.delegate.getRoomInfo.type == RoomType_MiniGame) {
|
||||||
[self.littleGameMiniView needRefreshPosition:queue];
|
[self.littleGameMiniView needRefreshPosition:queue];
|
||||||
} else if(self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
} else if(self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||||
if (self.roompkPanelView.pkDetailInfo) {
|
self.roompkPanelView.micQueue = queue;
|
||||||
self.roompkPanelView.micQueue = queue;
|
|
||||||
} else {
|
|
||||||
[self.roompkPanelView enterRoomGetRoomPKDetailInfo];
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
MicroQueueModel * currentUserModel;
|
MicroQueueModel * currentUserModel;
|
||||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||||
|
@@ -38,6 +38,7 @@
|
|||||||
#import "XPUserCardViewController.h"
|
#import "XPUserCardViewController.h"
|
||||||
#import "XPRoomTopicAlertView.h"
|
#import "XPRoomTopicAlertView.h"
|
||||||
#import "XPRoomSendTextView.h"
|
#import "XPRoomSendTextView.h"
|
||||||
|
#import "XPRoomPKResultView.h"
|
||||||
|
|
||||||
@implementation XPRoomMessageParser
|
@implementation XPRoomMessageParser
|
||||||
|
|
||||||
@@ -288,24 +289,39 @@
|
|||||||
} else if(attachment.second == Custom_Message_Sub_Room_PK_Result) {
|
} else if(attachment.second == Custom_Message_Sub_Room_PK_Result) {
|
||||||
NSString * victoryStr;
|
NSString * victoryStr;
|
||||||
if (model.result == RoomPKResultType_Draw) {
|
if (model.result == RoomPKResultType_Draw) {
|
||||||
|
RoomPKTeamModel * blueTeam;
|
||||||
|
RoomPKTeamModel * redTeam;
|
||||||
|
for (int i = 0 ; i < model.teams.count; i++) {
|
||||||
|
RoomPKTeamModel * team = [model.teams objectAtIndex:i];
|
||||||
|
if (team.team == GroupType_Red) {
|
||||||
|
redTeam = team;
|
||||||
|
}else{
|
||||||
|
blueTeam = team;
|
||||||
|
}
|
||||||
|
}
|
||||||
RoomPKTeamModel * team = [model.teams firstObject];
|
RoomPKTeamModel * team = [model.teams firstObject];
|
||||||
if (model.voteMode == RoomPKVoteModeType_NumberPerson) {
|
if (model.voteMode == RoomPKVoteModeType_NumberPerson) {
|
||||||
victoryStr = @"平局";
|
victoryStr = @"平局";
|
||||||
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
||||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, resultScale];
|
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\nPK值:%@",victoryStr, resultScale];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}else{
|
}else{
|
||||||
if (team.protecScore > 0) {
|
if (team.protecScore > 0) {
|
||||||
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", team.score],[NSString stringWithFormat:@"%lld", team.score]];
|
||||||
victoryStr = @"平局";
|
victoryStr = @"平局";
|
||||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, resultScale];
|
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\nPK值%@",victoryStr, resultScale];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}else{
|
}else{
|
||||||
victoryStr = @"平局";
|
victoryStr = @"平局";
|
||||||
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@",victoryStr, @"0:0"];
|
NSString * result = [NSString stringWithFormat:@"本场PK结果:%@!\nPK值%@",victoryStr, @"0:0"];
|
||||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (team.score > 0) {
|
||||||
|
[attribute appendAttributedString:[[NSMutableAttributedString alloc] initWithString:@"\n"]];
|
||||||
|
NSString * teamStr = [NSString stringWithFormat:@"蓝队守护者:%@ \n 蓝队守护值: %@ \n 红队守护者: %@ \n 红队守护值: %@", blueTeam.protector.nick.length > 0 ? blueTeam.protector.nick : @"", [[NSNumber numberWithLongLong:blueTeam.protecScore] stringValue], redTeam.protector.nick.length > 0 ? redTeam.protector.nick : @"", [[NSNumber numberWithLongLong:redTeam.protecScore] stringValue]];
|
||||||
|
[attribute appendAttributedString:[self createTextAttribute:teamStr color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
RoomPKTeamModel * victoryTeam;
|
RoomPKTeamModel * victoryTeam;
|
||||||
RoomPKTeamModel * failTeam;
|
RoomPKTeamModel * failTeam;
|
||||||
@@ -317,26 +333,31 @@
|
|||||||
failTeam = team;
|
failTeam = team;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.result == RoomPKResultType_Red){
|
if (model.result == RoomPKResultType_Red){
|
||||||
victoryStr = @"红队胜利";
|
victoryStr = @"红队";
|
||||||
}else if (model.result == RoomPKResultType_Blue){
|
}else if (model.result == RoomPKResultType_Blue){
|
||||||
victoryStr = @"蓝队胜利";
|
victoryStr = @"蓝队";
|
||||||
}
|
}
|
||||||
|
|
||||||
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", victoryTeam.score],[NSString stringWithFormat:@"%lld", failTeam.score]];
|
NSString * resultScale = [NSString stringWithFormat:@"%@:%@",[NSString stringWithFormat:@"%lld", victoryTeam.score],[NSString stringWithFormat:@"%lld", failTeam.score]];
|
||||||
NSString * result;
|
NSString * result;
|
||||||
if (model.voteMode == RoomPKVoteModeType_NumberPerson) {
|
if (model.voteMode == RoomPKVoteModeType_NumberPerson) {
|
||||||
result = [NSString stringWithFormat:@"本场PK结果:%@!\n PK值%@ \n 胜利方战斗值:%@",victoryStr, resultScale,[NSNumber numberWithLongLong:victoryTeam.score]];
|
result = [NSString stringWithFormat:@"本场PK结果:%@胜利!\nPK值%@ \n 胜利方战斗值:%@",victoryStr, resultScale,[NSNumber numberWithLongLong:victoryTeam.score]];
|
||||||
}else{
|
}else{
|
||||||
if (victoryTeam.protector) {
|
if (victoryTeam.protector) {
|
||||||
result = [NSString stringWithFormat:@"本场PK结果:%@ \n PK值%@ \n 胜利方战斗值:%@ \n 守护者:%@ \n 守护值:%@",victoryStr, resultScale,[[NSNumber numberWithLongLong:victoryTeam.score] stringValue],victoryTeam.protector.nick.length > 0 ?victoryTeam.protector.nick : @"", [[NSNumber numberWithLongLong:victoryTeam.protecScore] stringValue]];
|
NSString * victoryProteror = victoryTeam.protector.nick.length > 0 ? victoryTeam.protector.nick : @"";
|
||||||
|
result = [NSString stringWithFormat:@"本场PK结果:%@胜利! \nPK值%@ \n %@守护者:%@ \n %@守护值:%@",victoryStr, resultScale,victoryStr, victoryProteror, victoryStr,[[NSNumber numberWithLongLong:victoryTeam.protecScore] stringValue]];
|
||||||
}else{
|
}else{
|
||||||
result = [NSString stringWithFormat:@"本场PK结果:%@ \n PK值%@ \n 胜利方战斗值:%@ \n 守护值:%@",victoryStr, resultScale,[[NSNumber numberWithLongLong:victoryTeam.score] stringValue], [[NSNumber numberWithLongLong:victoryTeam.protecScore] stringValue]];
|
result = [NSString stringWithFormat:@"本场PK结果:%@胜利! \nPK值%@ \n %@守护值:%@",victoryStr, resultScale,victoryStr,[[NSNumber numberWithLongLong:victoryTeam.protecScore] stringValue]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
[attribute appendAttributedString:[self createTextAttribute:result color:[ThemeColor messageTextColor] font:kRoomMessageDefalutFont]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@kWeakify(self);
|
||||||
|
[attribute yy_setTextHighlightRange:NSMakeRange(0, attribute.length) color:nil backgroundColor:nil tapAction:^(UIView * _Nonnull containerView, NSAttributedString * _Nonnull text, NSRange range, CGRect rect) {
|
||||||
|
@kStrongify(self);
|
||||||
|
[self showRoomPKResult:attachment.data];
|
||||||
|
}];
|
||||||
} else if(attachment.second == Custom_Message_Sub_Room_PK_Mode_Open) {
|
} else if(attachment.second == Custom_Message_Sub_Room_PK_Mode_Open) {
|
||||||
NSString * pkType;
|
NSString * pkType;
|
||||||
if (model.voteMode == RoomPKVoteModeType_GiftValue) {
|
if (model.voteMode == RoomPKVoteModeType_GiftValue) {
|
||||||
@@ -363,6 +384,15 @@
|
|||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)showRoomPKResult:(NSDictionary *)dic {
|
||||||
|
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:dic];
|
||||||
|
if (pkInfo.pkStatus == RoomPKStatusType_End) {
|
||||||
|
XPRoomPKResultView * result = [[XPRoomPKResultView alloc] init];
|
||||||
|
result.roomPKResultInfoModel = pkInfo;
|
||||||
|
[TTPopup popupView:result style:TTPopupStyleAlert];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - 表情显示
|
#pragma mark - 表情显示
|
||||||
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
|
- (NSAttributedString*)createRoomFaceAttribute:(AttachmentModel *)attachment {
|
||||||
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
NSMutableAttributedString * attribute = [[NSMutableAttributedString alloc] init];
|
||||||
|
@@ -32,6 +32,8 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)miniRoom;
|
- (void)miniRoom;
|
||||||
- (UINavigationController *)getCurrentNav;
|
- (UINavigationController *)getCurrentNav;
|
||||||
- (NSArray *)getRoomSuperAdminList;
|
- (NSArray *)getRoomSuperAdminList;
|
||||||
|
///获取房间PK队伍的
|
||||||
|
- (NSArray *)getRoomPKGroupTeamList;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
@@ -123,8 +123,8 @@
|
|||||||
if (component == 0) {
|
if (component == 0) {
|
||||||
RoomPKTimeItemModel * model = [[self.datasource objectAtIndex:component] objectAtIndex:row];
|
RoomPKTimeItemModel * model = [[self.datasource objectAtIndex:component] objectAtIndex:row];
|
||||||
self.selectMinModel = model;
|
self.selectMinModel = model;
|
||||||
self.selectSecondModel = self.zeroModel;
|
|
||||||
if ([model.title isEqualToString:@"0分钟"]) {
|
if ([model.title isEqualToString:@"0分钟"]) {
|
||||||
|
self.selectSecondModel = self.thirdModel;
|
||||||
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
||||||
if ([array containsObject:self.zeroModel]) {
|
if ([array containsObject:self.zeroModel]) {
|
||||||
[array removeObject:self.zeroModel];
|
[array removeObject:self.zeroModel];
|
||||||
@@ -134,6 +134,7 @@
|
|||||||
[array addObject:self.thirdModel];
|
[array addObject:self.thirdModel];
|
||||||
}
|
}
|
||||||
}else if ([model.title isEqualToString:@"30分钟"]) {
|
}else if ([model.title isEqualToString:@"30分钟"]) {
|
||||||
|
self.selectSecondModel = self.zeroModel;
|
||||||
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
||||||
if ([array containsObject:self.thirdModel]) {
|
if ([array containsObject:self.thirdModel]) {
|
||||||
[array removeObject:self.thirdModel];
|
[array removeObject:self.thirdModel];
|
||||||
@@ -143,6 +144,7 @@
|
|||||||
[array insertObject:self.zeroModel atIndex:0];
|
[array insertObject:self.zeroModel atIndex:0];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
self.selectSecondModel = self.zeroModel;
|
||||||
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
NSMutableArray * array = [self.datasource objectAtIndex:1];
|
||||||
if (![array containsObject:self.zeroModel]) {
|
if (![array containsObject:self.zeroModel]) {
|
||||||
[array insertObject:self.zeroModel atIndex:0];
|
[array insertObject:self.zeroModel atIndex:0];
|
||||||
|
@@ -65,7 +65,7 @@
|
|||||||
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
||||||
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
||||||
if (redTeamScore > 0 || blueTeamScore > 0) {
|
if (redTeamScore > 0 || blueTeamScore > 0) {
|
||||||
CGFloat redScale = (long)redTeamScore / (long)(redTeamScore + blueTeamScore);
|
CGFloat redScale = (CGFloat)redTeamScore / (CGFloat)(redTeamScore + blueTeamScore);
|
||||||
if (redScale == 1) {
|
if (redScale == 1) {
|
||||||
redScale = 0.99;
|
redScale = 0.99;
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_BEGIN
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
@class RoomPKDetailInfoModel, MicroQueueModel, AttachmentModel, RoomInfoModel;
|
@class RoomPKDetailInfoModel, MicroQueueModel, AttachmentModel, RoomInfoModel, RoomPKChooseUserModel;
|
||||||
@interface XPRoomPKProgressView : UIView
|
@interface XPRoomPKProgressView : UIView
|
||||||
@property (nonatomic, strong) NSMutableDictionary<NSString *, MicroQueueModel *> *micQueue;
|
@property (nonatomic, strong) NSMutableDictionary<NSString *, MicroQueueModel *> *micQueue;
|
||||||
@property (nonatomic,strong) RoomPKDetailInfoModel *pkDetailInfo;
|
@property (nonatomic,strong) RoomPKDetailInfoModel *pkDetailInfo;
|
||||||
@@ -16,6 +16,10 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
@property (nonatomic,strong) RoomInfoModel *roomInfo;
|
||||||
///是否是管理员
|
///是否是管理员
|
||||||
@property (nonatomic,assign) BOOL isManager;
|
@property (nonatomic,assign) BOOL isManager;
|
||||||
|
///红色的
|
||||||
|
@property (nonatomic,strong, readonly) NSArray<RoomPKChooseUserModel *> *redChooseArray;
|
||||||
|
///蓝色的
|
||||||
|
@property (nonatomic,strong, readonly) NSArray<RoomPKChooseUserModel *> *blueChooseArray;
|
||||||
///收到礼物
|
///收到礼物
|
||||||
- (void)roomPKReceiveGift:(AttachmentModel *)attachment;
|
- (void)roomPKReceiveGift:(AttachmentModel *)attachment;
|
||||||
///进房请求当前房间PK详情
|
///进房请求当前房间PK详情
|
||||||
|
@@ -103,6 +103,7 @@
|
|||||||
#pragma mark - Public Method
|
#pragma mark - Public Method
|
||||||
- (void)handleRoomPKCustomMessage:(AttachmentModel *)attachment {
|
- (void)handleRoomPKCustomMessage:(AttachmentModel *)attachment {
|
||||||
if (attachment.second == Custom_Message_Sub_Room_PK_Start) {
|
if (attachment.second == Custom_Message_Sub_Room_PK_Start) {
|
||||||
|
[XCHUDTool showSuccessWithMessage:@"开始PK成功"];
|
||||||
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
||||||
self.pkDetailInfo.roomPK = pkInfo;
|
self.pkDetailInfo.roomPK = pkInfo;
|
||||||
self.beginButton.hidden = YES;
|
self.beginButton.hidden = YES;
|
||||||
@@ -117,11 +118,11 @@
|
|||||||
self.pkDetailInfo.roomPK = pkInfo;
|
self.pkDetailInfo.roomPK = pkInfo;
|
||||||
[self handleRoomPKInfoChangeState];
|
[self handleRoomPKInfoChangeState];
|
||||||
} else if(attachment.second == Custom_Message_Sub_Room_PK_Result) {
|
} else if(attachment.second == Custom_Message_Sub_Room_PK_Result) {
|
||||||
|
|
||||||
[TTPopup dismiss];
|
[TTPopup dismiss];
|
||||||
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
RoomPKInfoModel * pkInfo = [RoomPKInfoModel modelWithDictionary:attachment.data];
|
||||||
self.isReceivePKResult = YES;
|
self.isReceivePKResult = YES;
|
||||||
[self stopRoomPKCountDown];
|
[self stopRoomPKCountDown];
|
||||||
|
[self clearRoomPKTeamData];
|
||||||
self.checkResultNum = 1;
|
self.checkResultNum = 1;
|
||||||
if (pkInfo.pkStatus == RoomPKStatusType_ReStart) {///重新开始了 需要重新赋值
|
if (pkInfo.pkStatus == RoomPKStatusType_ReStart) {///重新开始了 需要重新赋值
|
||||||
self.pkDetailInfo.roomPK = pkInfo;
|
self.pkDetailInfo.roomPK = pkInfo;
|
||||||
@@ -221,6 +222,7 @@
|
|||||||
for (int i = 0; i < pkDetailInfo.roomPK.teams.count; i++) {
|
for (int i = 0; i < pkDetailInfo.roomPK.teams.count; i++) {
|
||||||
RoomPKTeamModel * teamInfo = [pkDetailInfo.roomPK.teams objectAtIndex:i];
|
RoomPKTeamModel * teamInfo = [pkDetailInfo.roomPK.teams objectAtIndex:i];
|
||||||
if (teamInfo.team == GroupType_Red) {
|
if (teamInfo.team == GroupType_Red) {
|
||||||
|
self.redTeamScore = teamInfo.score;
|
||||||
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
||||||
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
||||||
RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init];
|
RoomPKChooseUserModel * redInfo = [[RoomPKChooseUserModel alloc] init];
|
||||||
@@ -232,6 +234,7 @@
|
|||||||
[redArray addObject:redInfo];
|
[redArray addObject:redInfo];
|
||||||
}
|
}
|
||||||
} else if(teamInfo.team == GroupType_Blue) {
|
} else if(teamInfo.team == GroupType_Blue) {
|
||||||
|
self.blueTeamScore = teamInfo.score;
|
||||||
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
for (int i = 0; i < teamInfo.teamMembers.count; i++) {
|
||||||
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
RoomPKTeamUserModel * teamUserModel = [teamInfo.teamMembers objectAtIndex:i];
|
||||||
RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init];
|
RoomPKChooseUserModel * blueInfo = [[RoomPKChooseUserModel alloc] init];
|
||||||
@@ -244,6 +247,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
[self configRedTeamScore:self.redTeamScore blueTeamScore:self.blueTeamScore];
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0 ; i < queue.allValues.count; i++) {
|
for (int i = 0 ; i < queue.allValues.count; i++) {
|
||||||
MicroQueueModel * micModel = [queue.allValues objectAtIndex:i];
|
MicroQueueModel * micModel = [queue.allValues objectAtIndex:i];
|
||||||
@@ -340,10 +344,12 @@
|
|||||||
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
self.redScoreLabel.text = [NSString stringWithFormat:@"%ld", redTeamScore];
|
||||||
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
self.blueScoreLabel.text = [NSString stringWithFormat:@"%ld", blueTeamScore];
|
||||||
if (redTeamScore > 0 || blueTeamScore > 0) {
|
if (redTeamScore > 0 || blueTeamScore > 0) {
|
||||||
CGFloat redScale = (long)redTeamScore / (long)(redTeamScore + blueTeamScore);
|
CGFloat redScale = (CGFloat)redTeamScore / (CGFloat)(redTeamScore + blueTeamScore);
|
||||||
if (redScale == 1) {
|
if (redScale == 1) {
|
||||||
redScale = 0.99;
|
redScale = 0.99;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[self.redProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
[self.redProgressView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||||
make.width.mas_equalTo(85 * 2 * redScale);
|
make.width.mas_equalTo(85 * 2 * redScale);
|
||||||
}];
|
}];
|
||||||
@@ -585,9 +591,14 @@
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RoomPKStatusType_ReStart:
|
case RoomPKStatusType_ReStart:
|
||||||
|
case RoomPKStatusType_NonStart:
|
||||||
|
{
|
||||||
self.beginButton.hidden = self.isManager ? NO : YES;
|
self.beginButton.hidden = self.isManager ? NO : YES;
|
||||||
break;
|
[self clearRoomPKTeamData];
|
||||||
|
[self stopRoomPKCountDown];
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -749,16 +760,7 @@
|
|||||||
[Api createRoomPK:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
[Api createRoomPK:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||||
if (code == 200) {
|
if (code == 200) {
|
||||||
RoomPKInfoModel * newRoomPKInfo = [RoomPKInfoModel modelWithDictionary:data.data];
|
RoomPKInfoModel * newRoomPKInfo = [RoomPKInfoModel modelWithDictionary:data.data];
|
||||||
NSString * teamJsonStr = [self roomPKTeamJsonString];
|
self.pkDetailInfo.roomPK = newRoomPKInfo;
|
||||||
///开始PK
|
|
||||||
[Api begainRoomPK:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
|
||||||
if (code == 200) {
|
|
||||||
RoomPKDetailInfoModel * detailPKInfo = [RoomPKDetailInfoModel modelWithDictionary:data.data];
|
|
||||||
self.pkDetailInfo = detailPKInfo;
|
|
||||||
} else {
|
|
||||||
[XCHUDTool showErrorWithMessage:msg];
|
|
||||||
}
|
|
||||||
} roomUid:roomUid pkId:newRoomPKInfo.pkId joinUsers:teamJsonStr];
|
|
||||||
} else {
|
} else {
|
||||||
[XCHUDTool showErrorWithMessage:msg];
|
[XCHUDTool showErrorWithMessage:msg];
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,8 @@
|
|||||||
@property (nonatomic,strong) UIView * pkUserContaierView;
|
@property (nonatomic,strong) UIView * pkUserContaierView;
|
||||||
///PK选手
|
///PK选手
|
||||||
@property (nonatomic,strong) UILabel *pkUserLabel;
|
@property (nonatomic,strong) UILabel *pkUserLabel;
|
||||||
|
///输的一方显示文案
|
||||||
|
@property (nonatomic,strong) UILabel *failDesLabel;
|
||||||
///战斗值
|
///战斗值
|
||||||
@property (nonatomic,strong) XPRomPKResultTitleLabel *fightScoreLable;
|
@property (nonatomic,strong) XPRomPKResultTitleLabel *fightScoreLable;
|
||||||
///守护者
|
///守护者
|
||||||
@@ -82,6 +84,7 @@
|
|||||||
|
|
||||||
[self.contentImageView addSubview:self.stackView];
|
[self.contentImageView addSubview:self.stackView];
|
||||||
[self.contentImageView addSubview:self.resultButton];
|
[self.contentImageView addSubview:self.resultButton];
|
||||||
|
[self.contentImageView addSubview:self.failDesLabel];
|
||||||
[self.contentImageView addSubview:self.checkButton];
|
[self.contentImageView addSubview:self.checkButton];
|
||||||
|
|
||||||
[self.stackView addArrangedSubview:self.pkUserContaierView];
|
[self.stackView addArrangedSubview:self.pkUserContaierView];
|
||||||
@@ -107,7 +110,7 @@
|
|||||||
|
|
||||||
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.topImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.centerX.top.mas_equalTo(self);
|
make.centerX.top.mas_equalTo(self);
|
||||||
make.width.mas_equalTo(375);
|
make.width.mas_equalTo(385);
|
||||||
make.height.mas_equalTo(243);
|
make.height.mas_equalTo(243);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -148,11 +151,16 @@
|
|||||||
|
|
||||||
[self.resultButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.resultButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.centerX.mas_equalTo(self);
|
make.centerX.mas_equalTo(self);
|
||||||
make.bottom.mas_equalTo(self.checkButton.mas_top).offset(-10);
|
make.bottom.mas_equalTo(self.failDesLabel.mas_top).offset(-10);
|
||||||
make.width.mas_equalTo(230);
|
make.width.mas_equalTo(230);
|
||||||
make.height.mas_equalTo(30);
|
make.height.mas_equalTo(30);
|
||||||
}];
|
}];
|
||||||
|
|
||||||
|
[self.failDesLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
|
make.bottom.mas_equalTo(self.checkButton.mas_top).offset(-10);
|
||||||
|
make.left.right.mas_equalTo(self.contentImageView);
|
||||||
|
}];
|
||||||
|
|
||||||
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
[self.checkButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||||
make.height.mas_equalTo(16);
|
make.height.mas_equalTo(16);
|
||||||
make.left.right.mas_equalTo(self.contentImageView);
|
make.left.right.mas_equalTo(self.contentImageView);
|
||||||
@@ -276,6 +284,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.failDesLabel.hidden = YES;
|
||||||
if (myType == GroupType_Red) {///我是红队的
|
if (myType == GroupType_Red) {///我是红队的
|
||||||
[self handleMyInRedPKTeam:redTeam bluePKTeam:blueTeam];
|
[self handleMyInRedPKTeam:redTeam bluePKTeam:blueTeam];
|
||||||
} else if(myType == GroupType_Blue) {///我是蓝队的
|
} else if(myType == GroupType_Blue) {///我是蓝队的
|
||||||
@@ -285,7 +294,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 自己是红队时布局
|
// 自己是红队时布局
|
||||||
- (void)handleMyInRedPKTeam:(RoomPKTeamModel *)redPKTeam bluePKTeam:(RoomPKTeamModel *)bluePKTeam {
|
- (void)handleMyInRedPKTeam:(RoomPKTeamModel *)redPKTeam bluePKTeam:(RoomPKTeamModel *)bluePKTeam {
|
||||||
if (self.isChecOther) { // 查看对方战绩
|
if (self.isChecOther) { // 查看对方战绩
|
||||||
@@ -337,17 +345,16 @@
|
|||||||
if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // win
|
if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // win
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_win_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_win_bg"];
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_win_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_win_bg"];
|
||||||
[self.resultButton setTitle:@"· 您胜利了 ·" forState:UIControlStateNormal];
|
|
||||||
[self.checkButton setTitle:@"查看蓝队战绩>" forState:UIControlStateNormal];
|
|
||||||
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Blue) { // loser
|
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Blue) { // loser
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_loser_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_loser_bg"];
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
||||||
[self.resultButton setTitle:@"· 您失败了 ·" forState:UIControlStateNormal];
|
self.failDesLabel.hidden = NO;
|
||||||
} else { // 平局
|
} else { // 平局
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_draw_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_draw_bg"];
|
||||||
[self.resultButton setTitle:@"· 势均力敌 ·" forState:UIControlStateNormal];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
||||||
}
|
}
|
||||||
|
[self.resultButton setTitle:@"· 红队战绩 ·" forState:UIControlStateNormal];
|
||||||
|
[self.checkButton setTitle:@"查看对方战绩>" forState:UIControlStateNormal];
|
||||||
[self.resultButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
[self.resultButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
||||||
[self.checkButton setTitleColor:kBlueTeamColor forState:UIControlStateNormal];
|
[self.checkButton setTitleColor:kBlueTeamColor forState:UIControlStateNormal];
|
||||||
self.fightScoreLable.groupType = GroupType_Red;
|
self.fightScoreLable.groupType = GroupType_Red;
|
||||||
@@ -425,18 +432,15 @@
|
|||||||
if (self.roomPKResultInfoModel.result == RoomPKResultType_Blue) { // win
|
if (self.roomPKResultInfoModel.result == RoomPKResultType_Blue) { // win
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_win_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_win_bg"];
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_win_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_win_bg"];
|
||||||
[self.resultButton setTitle:@"· 您胜利啦! ·" forState:UIControlStateNormal];
|
|
||||||
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // loser
|
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // loser
|
||||||
|
self.failDesLabel.hidden = NO;
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_loser_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_loser_bg"];
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
||||||
[self.resultButton setTitle:@"· 你失败啦! ·" forState:UIControlStateNormal];
|
|
||||||
[self.checkButton setTitle:@"查看红队战绩>" forState:UIControlStateNormal];
|
|
||||||
} else { // 平局
|
} else { // 平局
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_draw_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_draw_bg"];
|
||||||
[self.resultButton setTitle:@"· 势均力敌 ·" forState:UIControlStateNormal];
|
|
||||||
}
|
}
|
||||||
|
[self.resultButton setTitle:@"· 蓝队战绩 ·" forState:UIControlStateNormal];
|
||||||
[self.resultButton setTitleColor:kBlueTeamColor forState:UIControlStateNormal];
|
[self.resultButton setTitleColor:kBlueTeamColor forState:UIControlStateNormal];
|
||||||
[self.checkButton setTitle:@"查看红队战绩>" forState:UIControlStateNormal];
|
[self.checkButton setTitle:@"查看红队战绩>" forState:UIControlStateNormal];
|
||||||
[self.checkButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
[self.checkButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
||||||
@@ -542,8 +546,8 @@
|
|||||||
self.guardScoreLable.content = [NSString stringWithFormat:@"%lld", bluePKTeam.protecScore];
|
self.guardScoreLable.content = [NSString stringWithFormat:@"%lld", bluePKTeam.protecScore];
|
||||||
[self loadTeamMemberUserAvatar:bluePKTeam.teamMembers mvpUserId:bluePKTeam.mvp];
|
[self loadTeamMemberUserAvatar:bluePKTeam.teamMembers mvpUserId:bluePKTeam.mvp];
|
||||||
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // loser
|
} else if (self.roomPKResultInfoModel.result == RoomPKResultType_Red) { // loser
|
||||||
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_loser_bg"];
|
self.topImageView.image = [UIImage imageNamed:@"room_pk_result_top_win_bg"];
|
||||||
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_loser_bg"];
|
self.bottomImageView.image = [UIImage imageNamed:@"room_pk_result_bottom_win_bg"];
|
||||||
[self.resultButton setTitle:@"· 红队胜利 ·" forState:UIControlStateNormal];
|
[self.resultButton setTitle:@"· 红队胜利 ·" forState:UIControlStateNormal];
|
||||||
[self.resultButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
[self.resultButton setTitleColor:kRedTeamColor forState:UIControlStateNormal];
|
||||||
[self.checkButton setTitle:@"查看蓝队战绩>" forState:UIControlStateNormal];
|
[self.checkButton setTitle:@"查看蓝队战绩>" forState:UIControlStateNormal];
|
||||||
@@ -769,6 +773,17 @@
|
|||||||
return _mvpImageView;
|
return _mvpImageView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UILabel *)failDesLabel {
|
||||||
|
if (!_failDesLabel) {
|
||||||
|
_failDesLabel = [[UILabel alloc] init];
|
||||||
|
_failDesLabel.font = [UIFont systemFontOfSize:15];
|
||||||
|
_failDesLabel.textColor = UIColorFromRGB(0x666666);
|
||||||
|
_failDesLabel.textAlignment = NSTextAlignmentCenter;
|
||||||
|
_failDesLabel.text = [NSString stringWithFormat:@"别气馁,%@永远支持你", AppName];
|
||||||
|
}
|
||||||
|
return _failDesLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
#import "RoomInfoModel.h"
|
#import "RoomInfoModel.h"
|
||||||
#import "RoomPKChooseUserModel.h"
|
#import "RoomPKChooseUserModel.h"
|
||||||
#import "AttachmentModel.h"
|
#import "AttachmentModel.h"
|
||||||
|
#import "RoomPKChooseUserModel.h"
|
||||||
///View
|
///View
|
||||||
#import "XPRoomPKVoteTableViewCell.h"
|
#import "XPRoomPKVoteTableViewCell.h"
|
||||||
#import "XPRoomPKTypeTableViewCell.h"
|
#import "XPRoomPKTypeTableViewCell.h"
|
||||||
@@ -85,6 +86,17 @@
|
|||||||
self.title = @"创建PK";
|
self.title = @"创建PK";
|
||||||
self.duraTime = 30;
|
self.duraTime = 30;
|
||||||
self.voteType = RoomPKVoteModeType_GiftValue;
|
self.voteType = RoomPKVoteModeType_GiftValue;
|
||||||
|
NSArray * array = self.hostDelegate.getRoomPKGroupTeamList;
|
||||||
|
self.redUserArray = [array objectAtIndex:0];
|
||||||
|
self.blueUserArray = [array objectAtIndex:1];
|
||||||
|
for (RoomPKChooseUserModel * userInfo in self.redUserArray) {
|
||||||
|
userInfo.groupType = GroupType_default;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (RoomPKChooseUserModel * userInfo in self.blueUserArray) {
|
||||||
|
userInfo.groupType = GroupType_default;
|
||||||
|
}
|
||||||
|
|
||||||
[self addNavigationItemWithTitles:@[@"PK记录"] titleColor:[ThemeColor mainTextColor] isLeft:NO target:self action:@selector(rightNavAction:) tags:nil];
|
[self addNavigationItemWithTitles:@[@"PK记录"] titleColor:[ThemeColor mainTextColor] isLeft:NO target:self action:@selector(rightNavAction:) tags:nil];
|
||||||
[self.view addSubview:self.userContainerView];
|
[self.view addSubview:self.userContainerView];
|
||||||
[self.view addSubview:self.tableView];
|
[self.view addSubview:self.tableView];
|
||||||
@@ -97,6 +109,7 @@
|
|||||||
[self.userContainerView addSubview:self.roomPKLogoImageView];
|
[self.userContainerView addSubview:self.roomPKLogoImageView];
|
||||||
[self initUserContainerSubViews];
|
[self initUserContainerSubViews];
|
||||||
|
|
||||||
|
|
||||||
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
||||||
self.onceAgainPKButton.hidden = NO;
|
self.onceAgainPKButton.hidden = NO;
|
||||||
self.closePKButton.hidden = NO;
|
self.closePKButton.hidden = NO;
|
||||||
@@ -291,6 +304,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)closeRoomPKSuccess {
|
- (void)closeRoomPKSuccess {
|
||||||
|
[self showSuccessToast:@"关闭PK模式成功"];
|
||||||
[self.navigationController popViewControllerAnimated:YES];
|
[self.navigationController popViewControllerAnimated:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -915,6 +915,10 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
|
|||||||
return self.superMangerList;
|
return self.superMangerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)getRoomPKGroupTeamList {
|
||||||
|
return [self.functionView getRoomPKGroupTeamList];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
- (void)onMicroQueueUpdate:(NSMutableDictionary<NSString *,MicroQueueModel *> *)queue {
|
||||||
[self.menuContainerView onMicroQueueUpdate:queue];
|
[self.menuContainerView onMicroQueueUpdate:queue];
|
||||||
[self.functionView onRoomUpdate];
|
[self.functionView onRoomUpdate];
|
||||||
|
Reference in New Issue
Block a user