510 lines
20 KiB
Objective-C
510 lines
20 KiB
Objective-C
//
|
|
// YMRoomPKViewController.m
|
|
// YUMI
|
|
//
|
|
// Created by YUMI on 2022/3/17.
|
|
//
|
|
|
|
#import "XPRoomPKViewController.h"
|
|
///Third
|
|
#import <Masonry/Masonry.h>
|
|
///Tool
|
|
#import "TTPopup.h"
|
|
#import "YUMIMacroUitls.h"
|
|
#import "DJDKMIMOMColor.h"
|
|
#import "UIImage+Utils.h"
|
|
#import "NSObject+MJExtension.h"
|
|
#import "NSArray+Safe.h"
|
|
///Model
|
|
#import "RoomPKTimeItemModel.h"
|
|
#import "RoomInfoModel.h"
|
|
#import "RoomPKChooseUserModel.h"
|
|
#import "AttachmentModel.h"
|
|
#import "RoomPKChooseUserModel.h"
|
|
///View
|
|
#import "XPRoomPKVoteTableViewCell.h"
|
|
#import "XPRoomPKTypeTableViewCell.h"
|
|
#import "XPRoomPKTimeTableViewCell.h"
|
|
#import "XPRoomPKUserView.h"
|
|
#import "XPRoomPKTimePickerView.h"
|
|
#import "XPRoomPKRecordViewController.h"
|
|
#import "XPRoomPKSelectUserView.h"
|
|
///P
|
|
#import "XPRoomPKPresenter.h"
|
|
#import "XPRoomPKProtocol.h"
|
|
@interface XPRoomPKViewController ()<UITableViewDelegate, UITableViewDataSource, XPRoomPKTimePickerViewDelegate, XPRoomPKVoteTableViewCellDelegate, XPRoomPKProtocol, XPRoomPKSelectUserViewDelegate>
|
|
///用户的容器
|
|
@property (nonatomic,strong) UIView * userContainerView;
|
|
///红队
|
|
@property (nonatomic,strong) NSArray *redTeamViews;
|
|
///蓝队
|
|
@property (nonatomic,strong) NSArray *blueTeamViews;
|
|
///房间pklogo
|
|
@property (nonatomic,strong) UIImageView *roomPKLogoImageView;
|
|
///列表
|
|
@property (nonatomic,strong) UITableView *tableView;
|
|
///创建pk的容器
|
|
@property (nonatomic,strong) UIStackView *createPKStackView;
|
|
///创建PK
|
|
@property (nonatomic,strong) UIButton *createPKButton;
|
|
///再次创建
|
|
@property (nonatomic,strong) UIButton *onceAgainPKButton;
|
|
///关闭PK
|
|
@property (nonatomic,strong) UIButton *closePKButton;
|
|
///代理
|
|
@property (nonatomic,assign) id<RoomHostDelegate> hostDelegate;
|
|
///类型
|
|
@property (nonatomic,assign) RoomPKVoteModeType voteType;
|
|
///时间
|
|
@property (nonatomic,assign) int duraTime;
|
|
///红队的成员
|
|
@property (nonatomic,strong) NSMutableArray *redUserArray;
|
|
///蓝队的成员
|
|
@property (nonatomic,strong) NSMutableArray *blueUserArray;
|
|
@end
|
|
|
|
@implementation XPRoomPKViewController
|
|
|
|
- (XPRoomPKPresenter *)createPresenter {
|
|
return [[XPRoomPKPresenter alloc] init];
|
|
}
|
|
|
|
- (instancetype)initWithDelegate:(id<RoomHostDelegate>)delegate {
|
|
if (self = [super init]) {
|
|
self.hostDelegate = delegate;
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)viewDidLoad {
|
|
[super viewDidLoad];
|
|
[self initSubViews];
|
|
[self initSubViewConstraints];
|
|
}
|
|
|
|
#pragma mark - Private Method
|
|
- (void)initSubViews {
|
|
self.title = YMLocalizedString(@"XPRoomPKViewController0");
|
|
self.duraTime = 30;
|
|
self.voteType = RoomPKVoteModeType_GiftValue;
|
|
NSArray * array = self.hostDelegate.getRoomPKGroupTeamList;
|
|
self.redUserArray = [NSMutableArray arrayWithArray:[array safeObjectAtIndex1:0]];
|
|
self.blueUserArray = [NSMutableArray arrayWithArray:[array safeObjectAtIndex1:1]];
|
|
for (RoomPKChooseUserModel * userInfo in self.redUserArray) {
|
|
userInfo.groupType = GroupType_default;
|
|
}
|
|
|
|
for (RoomPKChooseUserModel * userInfo in self.blueUserArray) {
|
|
userInfo.groupType = GroupType_default;
|
|
}
|
|
|
|
[self addNavigationItemWithTitles:@[YMLocalizedString(@"XPRoomPKViewController1")] titleColor:[DJDKMIMOMColor mainTextColor] isLeft:NO target:self action:@selector(rightNavAction:) tags:nil];
|
|
[self.view addSubview:self.userContainerView];
|
|
[self.view addSubview:self.tableView];
|
|
[self.view addSubview:self.createPKStackView];
|
|
|
|
[self.createPKStackView addArrangedSubview:self.createPKButton];
|
|
[self.createPKStackView addArrangedSubview:self.onceAgainPKButton];
|
|
[self.createPKStackView addArrangedSubview:self.closePKButton];
|
|
|
|
[self.userContainerView addSubview:self.roomPKLogoImageView];
|
|
[self initUserContainerSubViews];
|
|
|
|
|
|
if (self.hostDelegate.getRoomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
|
|
self.onceAgainPKButton.hidden = NO;
|
|
self.closePKButton.hidden = NO;
|
|
self.createPKButton.hidden = YES;
|
|
} else {
|
|
self.createPKButton.hidden = NO;
|
|
}
|
|
}
|
|
|
|
- (void)initSubViewConstraints {
|
|
XPRoomPKUserView * userView = [self.redTeamViews lastObject];
|
|
[self.userContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.view).offset(10);
|
|
make.bottom.mas_equalTo(userView.mas_bottom).offset(20);
|
|
}];
|
|
|
|
[self.roomPKLogoImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.center.mas_equalTo(self.userContainerView);
|
|
make.width.mas_equalTo(43);
|
|
make.height.mas_equalTo(64);
|
|
}];
|
|
|
|
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.bottom.mas_equalTo(self.view);
|
|
make.top.mas_equalTo(self.userContainerView.mas_bottom);
|
|
}];
|
|
|
|
[self.createPKStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.left.right.mas_equalTo(self.view).inset(47);
|
|
make.bottom.mas_equalTo(self.view).offset(-kSafeAreaBottomHeight - 20);
|
|
}];
|
|
|
|
[self.createPKButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(44);
|
|
}];
|
|
|
|
[self.onceAgainPKButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(44);
|
|
}];
|
|
|
|
[self.closePKButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.height.mas_equalTo(44);
|
|
}];
|
|
}
|
|
|
|
- (void)initUserContainerSubViews {
|
|
CGFloat itemWidth = 60;
|
|
CGFloat itemHeight = 67;
|
|
CGFloat pkItemWidth = 72;
|
|
CGFloat pkItemMargeHeight = 10;
|
|
CGFloat itemSpace = (KScreenWidth - itemWidth * 4 - 72 - 13 * 2)/ 2;
|
|
NSMutableArray * redArray = [NSMutableArray array];
|
|
for (int i = 0; i< 4; i++) {
|
|
XPRoomPKUserView * redView = [[XPRoomPKUserView alloc] init];
|
|
[redArray addObject:redView];
|
|
redView.type = RoomPKUserViewType_Red;
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(redDidTapRecognizer:)];
|
|
[redView addGestureRecognizer:tap];
|
|
[self.userContainerView addSubview:redView];
|
|
[redView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(itemWidth, itemHeight));
|
|
make.left.mas_equalTo(self.userContainerView).offset(13+ i % 2 * (itemWidth + itemSpace));
|
|
make.top.mas_equalTo(self.userContainerView).offset(i / 2 *(itemHeight + pkItemMargeHeight));
|
|
}];
|
|
}
|
|
self.redTeamViews = [redArray copy];
|
|
|
|
NSMutableArray * blueArray = [NSMutableArray array];
|
|
for (int i = 0; i< 4; i++) {
|
|
XPRoomPKUserView * blueView = [[XPRoomPKUserView alloc] init];
|
|
[blueArray addObject:blueView];
|
|
blueView.type = RoomPKUserViewType_Blue;
|
|
UITapGestureRecognizer * tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(blueDidTapRecognizer:)];
|
|
[blueView addGestureRecognizer:tap];
|
|
[self.userContainerView addSubview:blueView];
|
|
[blueView mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
make.size.mas_equalTo(CGSizeMake(itemWidth, itemHeight));
|
|
make.left.mas_equalTo(self.userContainerView).offset(13 + itemWidth * 2 + itemSpace + pkItemWidth + i % 2 * (itemWidth + itemSpace));
|
|
make.top.mas_equalTo(self.userContainerView).offset(i / 2 *(itemHeight + pkItemMargeHeight));
|
|
}];
|
|
}
|
|
self.blueTeamViews = [blueArray copy];
|
|
}
|
|
|
|
#pragma mark - UITableViewDelegate And UITableViewDataSource
|
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
return 3;
|
|
}
|
|
|
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
return 50;
|
|
}
|
|
|
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
if (indexPath.row == 0) {
|
|
XPRoomPKTypeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomPKTypeTableViewCell class])];
|
|
if (cell == nil) {
|
|
cell = [[XPRoomPKTypeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomPKTypeTableViewCell class])];
|
|
}
|
|
return cell;
|
|
} else if(indexPath.row == 1) {
|
|
XPRoomPKVoteTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomPKVoteTableViewCell class])];
|
|
if (cell == nil) {
|
|
cell = [[XPRoomPKVoteTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomPKVoteTableViewCell class])];
|
|
}
|
|
cell.delegate = self;
|
|
return cell;
|
|
} else {
|
|
XPRoomPKTimeTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPRoomPKTimeTableViewCell class])];
|
|
if (cell == nil) {
|
|
cell = [[XPRoomPKTimeTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPRoomPKTimeTableViewCell class])];
|
|
}
|
|
return cell;
|
|
}
|
|
}
|
|
|
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
[tableView deselectRowAtIndexPath:indexPath animated:YES];
|
|
if (indexPath.row == 2) {
|
|
XPRoomPKTimePickerView * timePicker = [[XPRoomPKTimePickerView alloc] init];
|
|
timePicker.delegate = self;
|
|
[TTPopup popupView:timePicker style:TTPopupStyleActionSheet];
|
|
}
|
|
}
|
|
#pragma mark - XPRoomPKTimePickerViewDelegate
|
|
- (void)xPRoomPKTimePickerView:(XPRoomPKTimePickerView *)view timeModel:(RoomPKTimeItemModel *)model {
|
|
XPRoomPKTimeTableViewCell * cell = [self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:2 inSection:0]];
|
|
self.duraTime = model.time;
|
|
cell.time = model.title;
|
|
}
|
|
|
|
#pragma mark - XPRoomPKVoteTableViewCellDelegate
|
|
- (void)xPRoomPKVoteTableViewCell:(XPRoomPKVoteTableViewCell *)view didChooseVoteType:(RoomPKVoteModeType)VoteType {
|
|
self.voteType = VoteType;
|
|
}
|
|
|
|
#pragma mark - XPRoomPKSelectUserViewDelegate
|
|
- (void)xPRoomPKSelectUserView:(XPRoomPKSelectUserView *)view groupType:(GroupType)groupType didChooseUserInfos:(NSArray<RoomPKChooseUserModel *> *)userInfos {
|
|
[TTPopup dismiss];
|
|
if (groupType == GroupType_Red) {
|
|
self.redUserArray = [NSMutableArray arrayWithArray:userInfos];;
|
|
} else {
|
|
self.blueUserArray = [NSMutableArray arrayWithArray:userInfos];
|
|
}
|
|
|
|
if (self.redUserArray.count > 0) {
|
|
for (int i = 0; i< self.redTeamViews.count; i++) {
|
|
XPRoomPKUserView * userView = [self.redTeamViews safeObjectAtIndex1:i];
|
|
userView.userInfo = nil;
|
|
}
|
|
}
|
|
|
|
if (self.blueUserArray.count > 0) {
|
|
for (int i = 0; i< self.blueTeamViews.count; i++) {
|
|
XPRoomPKUserView * userView = [self.blueTeamViews safeObjectAtIndex1:i];
|
|
userView.userInfo = nil;
|
|
}
|
|
}
|
|
|
|
|
|
for (int i = 0; i < self.redUserArray.count; i++) {
|
|
RoomPKChooseUserModel * userInfo = [self.redUserArray safeObjectAtIndex1:i];
|
|
if (i < self.redTeamViews.count) {
|
|
XPRoomPKUserView * userView = [self.redTeamViews safeObjectAtIndex1:i];
|
|
if (userInfo.groupType == GroupType_Red) {
|
|
userView.userInfo = userInfo;
|
|
} else {
|
|
userView.userInfo = nil;
|
|
[self.redUserArray removeObject:userInfo];
|
|
}
|
|
}
|
|
}
|
|
for (int i = 0; i < self.blueUserArray.count; i++) {
|
|
RoomPKChooseUserModel * userInfo = [self.blueUserArray safeObjectAtIndex1:i];
|
|
if (i < self.blueTeamViews.count) {
|
|
XPRoomPKUserView * userView = [self.blueTeamViews safeObjectAtIndex1:i];
|
|
if (userInfo.groupType == GroupType_Blue) {
|
|
userView.userInfo = userInfo;
|
|
} else {
|
|
userView.userInfo = nil;
|
|
[self.blueUserArray removeObject:userInfo];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
#pragma mark - XPRoomPKProtocol
|
|
- (void)openRoomPKSuccess {
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
[self.presenter createRoomPKMode:2 voteMode:self.voteType duration:self.duraTime roomUid:roomUid];
|
|
}
|
|
|
|
- (void)closeRoomPKSuccess {
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
|
|
- (void)createRoomPKSuccess:(RoomPKInfoModel *)roompkInfo {
|
|
[self showSuccessToast:YMLocalizedString(@"XPRoomPKViewController2")];
|
|
if (self.redUserArray.count > 0 || self.blueUserArray.count > 0) {
|
|
NSMutableDictionary * dic = [NSMutableDictionary dictionary];
|
|
for (int i = 0 ; i< self.redUserArray.count; i++) {
|
|
RoomPKChooseUserModel * model = [self.redUserArray safeObjectAtIndex1:i];
|
|
if (model.uid.integerValue <= 0) {
|
|
continue;
|
|
}
|
|
NSMutableDictionary * data =[[model model2dictionary] mutableCopy];
|
|
[data removeObjectForKey:@"title"];
|
|
[data removeObjectForKey:@"imageName"];
|
|
[data removeObjectForKey:@"userUrl"];
|
|
[data removeObjectForKey:@"isSelect"];
|
|
[data removeObjectForKey:@"isEnableChoose"];
|
|
[dic setValue:data forKey:model.uid];
|
|
}
|
|
|
|
for (int i = 0 ; i< self.blueUserArray.count; i++) {
|
|
RoomPKChooseUserModel * model = [self.blueUserArray safeObjectAtIndex1:i];
|
|
if (model.uid.integerValue <= 0) {
|
|
continue;
|
|
}
|
|
NSMutableDictionary * data =[[model model2dictionary] mutableCopy];
|
|
[data removeObjectForKey:@"title"];
|
|
[data removeObjectForKey:@"imageName"];
|
|
[data removeObjectForKey:@"userUrl"];
|
|
[data removeObjectForKey:@"isSelect"];
|
|
[data removeObjectForKey:@"isEnableChoose"];
|
|
[dic setValue:data forKey:model.uid];
|
|
}
|
|
|
|
if (dic.allKeys.count > 0) {
|
|
AttachmentModel * attachment = [[AttachmentModel alloc] init];
|
|
attachment.first = CustomMessageType_Room_PK;
|
|
attachment.second = Custom_Message_Sub_Room_PK_Manager_Up_Mic;
|
|
attachment.data = dic;
|
|
NSString *sessionID = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.roomId];
|
|
NIMMessage *message = [[NIMMessage alloc]init];
|
|
NIMCustomObject *object = [[NIMCustomObject alloc] init];
|
|
object.attachment = attachment;
|
|
message.messageObject = object;
|
|
//构造会话
|
|
NIMSession *session = [NIMSession session:sessionID type:NIMSessionTypeChatroom];
|
|
[[NIMSDK sharedSDK].chatManager sendMessage:message toSession:session error:nil];
|
|
}
|
|
}
|
|
[self.navigationController popViewControllerAnimated:YES];
|
|
}
|
|
|
|
#pragma mark - Event Response
|
|
- (void)createPKButtonAction:(UIButton *)sender {
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
[self.presenter openRoomPK:roomUid];
|
|
}
|
|
|
|
- (void)closePKButtonAction:(UIButton *)sender {
|
|
NSString * title = YMLocalizedString(@"XPRoomPKViewController3");
|
|
[TTPopup alertWithMessage:title confirmHandler:^{
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
[self.presenter closeRoomPK:roomUid];
|
|
} cancelHandler:^{
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
- (void)onceAgainPKButtonAction:(UIButton *)sender {
|
|
NSString * title = YMLocalizedString(@"XPRoomPKViewController4");
|
|
[TTPopup alertWithMessage:title confirmHandler:^{
|
|
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
[self.presenter createRoomPKMode:2 voteMode:self.voteType duration:self.duraTime roomUid:roomUid];
|
|
} cancelHandler:^{
|
|
|
|
}];
|
|
}
|
|
|
|
- (void)rightNavAction:(UIButton *)sender {
|
|
XPRoomPKRecordViewController * recordVC = [[XPRoomPKRecordViewController alloc] init];
|
|
recordVC.roomUid = [NSString stringWithFormat:@"%ld", self.hostDelegate.getRoomInfo.uid];
|
|
[self.navigationController pushViewController:recordVC animated:YES];
|
|
}
|
|
|
|
- (void)redDidTapRecognizer:(UITapGestureRecognizer *)tap {
|
|
XPRoomPKSelectUserView * chooseUserView = [[XPRoomPKSelectUserView alloc] init];
|
|
chooseUserView.delegate = self;
|
|
chooseUserView.redUserArray = self.redUserArray;
|
|
chooseUserView.blueUserArray = self.blueUserArray;
|
|
chooseUserView.groupType = GroupType_Red;
|
|
chooseUserView.microQueueArray = self.hostDelegate.getMicroQueue.allValues;
|
|
[TTPopup popupView:chooseUserView style:TTPopupStyleAlert];
|
|
}
|
|
|
|
- (void)blueDidTapRecognizer:(UITapGestureRecognizer *)tap {
|
|
XPRoomPKSelectUserView * chooseUserView = [[XPRoomPKSelectUserView alloc] init];
|
|
chooseUserView.delegate = self;
|
|
chooseUserView.redUserArray = self.redUserArray;
|
|
chooseUserView.blueUserArray = self.blueUserArray;
|
|
chooseUserView.groupType = GroupType_Blue;
|
|
chooseUserView.microQueueArray = self.hostDelegate.getMicroQueue.allValues;
|
|
[TTPopup popupView:chooseUserView style:TTPopupStyleAlert];
|
|
}
|
|
|
|
#pragma mark - Getters And Setters
|
|
- (UITableView *)tableView {
|
|
if (!_tableView) {
|
|
_tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
|
|
_tableView.delegate = self;
|
|
_tableView.dataSource = self;
|
|
_tableView.tableFooterView = [UIView new];
|
|
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
|
|
_tableView.backgroundColor = [UIColor clearColor];
|
|
_tableView.scrollEnabled = NO;
|
|
if (@available(iOS 11.0, *)) {
|
|
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
|
}
|
|
[_tableView registerClass:[XPRoomPKVoteTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomPKVoteTableViewCell class])];
|
|
[_tableView registerClass:[XPRoomPKTypeTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomPKTypeTableViewCell class])];
|
|
[_tableView registerClass:[XPRoomPKTimeTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPRoomPKTimeTableViewCell class])];
|
|
}
|
|
return _tableView;
|
|
}
|
|
|
|
- (UIStackView *)createPKStackView {
|
|
if (!_createPKStackView) {
|
|
_createPKStackView = [[UIStackView alloc] init];
|
|
_createPKStackView.axis = UILayoutConstraintAxisVertical;
|
|
_createPKStackView.distribution = UIStackViewDistributionFill;
|
|
_createPKStackView.alignment = UIStackViewAlignmentFill;
|
|
_createPKStackView.spacing = 10;
|
|
}
|
|
return _createPKStackView;
|
|
}
|
|
|
|
- (UIButton *)createPKButton {
|
|
if (!_createPKButton) {
|
|
_createPKButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_createPKButton setTitle:YMLocalizedString(@"XPRoomPKViewController5") forState:UIControlStateNormal];
|
|
[_createPKButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
_createPKButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
|
[_createPKButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
_createPKButton.layer.masksToBounds = YES;
|
|
_createPKButton.layer.cornerRadius = 22;
|
|
[_createPKButton addTarget:self action:@selector(createPKButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
}
|
|
return _createPKButton;
|
|
}
|
|
|
|
- (UIButton *)onceAgainPKButton {
|
|
if (!_onceAgainPKButton) {
|
|
_onceAgainPKButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_onceAgainPKButton setTitle:YMLocalizedString(@"XPRoomPKViewController6") forState:UIControlStateNormal];
|
|
[_onceAgainPKButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
|
_onceAgainPKButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
|
[_onceAgainPKButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor confirmButtonGradientStartColor], [DJDKMIMOMColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
_onceAgainPKButton.layer.masksToBounds = YES;
|
|
_onceAgainPKButton.layer.cornerRadius = 22;
|
|
[_onceAgainPKButton addTarget:self action:@selector(onceAgainPKButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
_onceAgainPKButton.hidden = YES;
|
|
}
|
|
return _onceAgainPKButton;
|
|
}
|
|
|
|
- (UIButton *)closePKButton {
|
|
if (!_closePKButton) {
|
|
_closePKButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
[_closePKButton setTitle:YMLocalizedString(@"XPRoomPKViewController7") forState:UIControlStateNormal];
|
|
[_closePKButton setTitleColor:[DJDKMIMOMColor disableButtonTextColor] forState:UIControlStateNormal];
|
|
_closePKButton.titleLabel.font = [UIFont systemFontOfSize:15];
|
|
[_closePKButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[DJDKMIMOMColor disableButtonColor], [DJDKMIMOMColor disableButtonColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
|
_closePKButton.layer.masksToBounds = YES;
|
|
_closePKButton.layer.cornerRadius = 22;
|
|
[_closePKButton addTarget:self action:@selector(closePKButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
_closePKButton.hidden= YES;
|
|
}
|
|
return _closePKButton;
|
|
}
|
|
|
|
|
|
- (UIView *)userContainerView {
|
|
if (!_userContainerView) {
|
|
_userContainerView = [[UIView alloc] init];
|
|
_userContainerView.backgroundColor = [DJDKMIMOMColor appBackgroundColor];
|
|
}
|
|
return _userContainerView;
|
|
}
|
|
|
|
- (UIImageView *)roomPKLogoImageView {
|
|
if (!_roomPKLogoImageView) {
|
|
_roomPKLogoImageView = [[UIImageView alloc] init];
|
|
_roomPKLogoImageView.userInteractionEnabled = YES;
|
|
_roomPKLogoImageView.image = [UIImage imageNamed:@"room_pk_vs_logo"];
|
|
}
|
|
return _roomPKLogoImageView;
|
|
}
|
|
|
|
|
|
|
|
@end
|