修改了房间内PK进度的UI

This commit is contained in:
fengshuo
2022-03-28 22:04:09 +08:00
parent 168156c72e
commit 239c8417a2
18 changed files with 708 additions and 0 deletions

View File

@@ -318,6 +318,8 @@
E81366FC26F0D2980076364C /* UIButton+EnlargeTouchArea.m in Sources */ = {isa = PBXBuildFile; fileRef = E81366FA26F0D2980076364C /* UIButton+EnlargeTouchArea.m */; };
E816C11527608A7500C84014 /* XPRoomMiniManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E816C11427608A7500C84014 /* XPRoomMiniManager.m */; };
E81AF31A27F19265003B9E43 /* XPHomeGradientLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = E81AF31927F19265003B9E43 /* XPHomeGradientLabel.m */; };
E81AF32527F1D5B8003B9E43 /* XPRoomPKProgressView.m in Sources */ = {isa = PBXBuildFile; fileRef = E81AF32427F1D5B8003B9E43 /* XPRoomPKProgressView.m */; };
E81AF32827F1EE69003B9E43 /* XPRoomPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = E81AF32727F1EE69003B9E43 /* XPRoomPKPanelUserView.m */; };
E81C1B1C27705F6B0020D1E4 /* XPArrangeMicPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B1B27705F6B0020D1E4 /* XPArrangeMicPresenter.m */; };
E81C1B1F27705F7A0020D1E4 /* XPArrangeMicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B1E27705F7A0020D1E4 /* XPArrangeMicViewController.m */; };
E81C1B2227705F950020D1E4 /* Api+ArrangeMic.m in Sources */ = {isa = PBXBuildFile; fileRef = E81C1B2127705F950020D1E4 /* Api+ArrangeMic.m */; };
@@ -1448,6 +1450,10 @@
E816C11427608A7500C84014 /* XPRoomMiniManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomMiniManager.m; sourceTree = "<group>"; };
E81AF31827F19265003B9E43 /* XPHomeGradientLabel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPHomeGradientLabel.h; sourceTree = "<group>"; };
E81AF31927F19265003B9E43 /* XPHomeGradientLabel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPHomeGradientLabel.m; sourceTree = "<group>"; };
E81AF32327F1D5B8003B9E43 /* XPRoomPKProgressView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPKProgressView.h; sourceTree = "<group>"; };
E81AF32427F1D5B8003B9E43 /* XPRoomPKProgressView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomPKProgressView.m; sourceTree = "<group>"; };
E81AF32627F1EE69003B9E43 /* XPRoomPKPanelUserView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomPKPanelUserView.h; sourceTree = "<group>"; };
E81AF32727F1EE69003B9E43 /* XPRoomPKPanelUserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomPKPanelUserView.m; sourceTree = "<group>"; };
E81C1B1927705F4B0020D1E4 /* XPArrangeMicProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicProtocol.h; sourceTree = "<group>"; };
E81C1B1A27705F6B0020D1E4 /* XPArrangeMicPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPArrangeMicPresenter.h; sourceTree = "<group>"; };
E81C1B1B27705F6B0020D1E4 /* XPArrangeMicPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPArrangeMicPresenter.m; sourceTree = "<group>"; };
@@ -4014,6 +4020,8 @@
E801273F27E323C800BAC3F2 /* XPRoomPKViewController.m */,
E8664ED427E434D5000171BA /* XPRoomPKRecordViewController.h */,
E8664ED527E434D5000171BA /* XPRoomPKRecordViewController.m */,
E81AF32327F1D5B8003B9E43 /* XPRoomPKProgressView.h */,
E81AF32427F1D5B8003B9E43 /* XPRoomPKProgressView.m */,
);
path = View;
sourceTree = "<group>";
@@ -4155,6 +4163,8 @@
E8664EE227E47711000171BA /* XPRoomPKRecordNickView.m */,
E8A88D2527E8193400CA8837 /* XPRoomPKSelectUserView.h */,
E8A88D2627E8193400CA8837 /* XPRoomPKSelectUserView.m */,
E81AF32627F1EE69003B9E43 /* XPRoomPKPanelUserView.h */,
E81AF32727F1EE69003B9E43 /* XPRoomPKPanelUserView.m */,
);
path = SubViews;
sourceTree = "<group>";
@@ -7336,6 +7346,7 @@
E8E5E1B327C397A400F457D8 /* HomeMenuInfoModel.m in Sources */,
E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */,
9B85F3532806AB9A006EDF51 /* XPAnchorPKResultView.m in Sources */,
E81AF32527F1D5B8003B9E43 /* XPRoomPKProgressView.m in Sources */,
E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */,
9B6E8577281ABECC0041A321 /* XPRoomInsideRecommendEmptyCell.m in Sources */,
E8E859D628264C2300EE4857 /* DispatchQueueLogFormatter.m in Sources */,
@@ -7462,6 +7473,7 @@
E800806227FD373D0055A8AB /* XPClanMemberTableViewCell.m in Sources */,
E80016452804268E00D6D17A /* XPMineClanIncomeStatisViewController.m in Sources */,
E88C72A3282917590047FB2B /* XPRoomMusicVoiceSettingView.m in Sources */,
E81AF32827F1EE69003B9E43 /* XPRoomPKPanelUserView.m in Sources */,
E84150BF27747BD300A7F548 /* Api+FirstRecharge.m in Sources */,
E8E859CF28264C2300EE4857 /* DDNumber.m in Sources */,
E84B0E422727EE0A008818C6 /* XPRoomMessageHeaderView.m in Sources */,

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_pk_progrss_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_pk_progrss_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_pk_progrss_blue_add@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_pk_progrss_blue_add@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 674 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_pk_progrss_line_bg@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_pk_progrss_line_bg@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 605 B

View File

@@ -0,0 +1,22 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "room_pk_progrss_red_add@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "room_pk_progrss_red_add@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 692 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -70,6 +70,7 @@
#import "XPAnchorFansTaskViewController.h"
#import "XPAnchorPkPanelView.h"
#import "XPWebViewController.h"
#import "XPRoomPKProgressView.h"
@interface XPRoomFunctionContainerView ()<XPAcrpssRoomPKPanelViewDelegate, XPRoomLittleGameListViewDelegate, XPAnchorPkPanelViewDelegate, XPRoomBackMusicPlayerViewDelegate>
///host
@@ -110,6 +111,8 @@
@property (nonatomic,strong) UIButton *musicEnterButton;
///
@property (nonatomic,strong) XPRoomBackMusicPlayerView *musicPlayView;
///PKview
@property (nonatomic,strong) XPRoomPKProgressView *roompkPanelView;
@end
@implementation XPRoomFunctionContainerView
@@ -280,6 +283,22 @@
return isGamePlaying;
}
- (void)configRoomPKPanelView {
RoomInfoModel * roomInfo = self.delegate.getRoomInfo;
if (roomInfo.roomModeType == RoomModeType_Open_PK_Mode) {
if (!self.roompkPanelView.superview) {
[self addSubview:self.roompkPanelView];
[self.roompkPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self).offset(15);
make.top.mas_equalTo(self).offset((58 + 5 + 6 + 12) + 33 + (60 + 6 + 12) * 2 + 15 * 2 + kNavigationHeight);
}];
}
} else {
if (self.roompkPanelView.superview) {
[self.roompkPanelView removeFromSuperview];
}
}
}
#pragma mark - RoomGuestDelegate
- (void)onRoomUpdate {
@@ -342,6 +361,7 @@
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
[self configLittleGameState];
[self configPlayMusicRoomTypeChange];
[self configRoomPKPanelView];
}
- (void)onRoomEntered {
@@ -407,6 +427,7 @@
[self updateRoomTopic];
[self showLittleGameMiniView:roomInfo.type micCount:roomInfo.mgMicNum];
[self configLittleGameState];
[self configRoomPKPanelView];
}
- (void)onRoomMiniEntered {
@@ -1455,6 +1476,7 @@
return _anchorPKPanelView;
}
- (XPRoomTrumpetView *)trumpetView {
if (!_trumpetView) {
_trumpetView = [[XPRoomTrumpetView alloc] init];
@@ -1501,4 +1523,12 @@
return _musicPlayView;
}
- (XPRoomPKProgressView *)roompkPanelView {
if (!_roompkPanelView) {
_roompkPanelView = [[XPRoomPKProgressView alloc] init];
}
return _roompkPanelView;
}
@end

View File

@@ -0,0 +1,17 @@
//
// XPRoomPKPanelUserView.h
// xplan-ios
//
// Created by 冯硕 on 2022/3/28.
//
#import <UIKit/UIKit.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomPKPanelUserView : UIView
@property (nonatomic,assign) GroupType type;
@property (nonatomic,strong) NSArray *userArray;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,275 @@
//
// XPRoomPKPanelUserView.m
// xplan-ios
//
// Created by on 2022/3/28.
//
#import "XPRoomPKPanelUserView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "NetImageView.h"
#import "ThemeColor.h"
@interface XPRoomPKPanelUserView ()
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) UIView * userView;
///
@property (nonatomic,strong) NetImageView *firstUserView;
///
@property (nonatomic,strong) NetImageView *secondUserView;
///
@property (nonatomic,strong) NetImageView *thirdUserView;
///
@property (nonatomic,strong) NetImageView *fourthUserView;
///
@property (nonatomic,strong) NetImageView *fifthUserView;
///
@property (nonatomic,strong) UIButton *addButton;
///
@property (nonatomic,strong) NSArray *viewArray;
@end
@implementation XPRoomPKPanelUserView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.stackView];
[self.stackView addArrangedSubview:self.addButton];
[self.stackView addArrangedSubview:self.userView];
[self.userView addSubview:self.fifthUserView];
[self.userView addSubview:self.fourthUserView];
[self.userView addSubview:self.thirdUserView];
[self.userView addSubview:self.secondUserView];
[self.userView addSubview:self.firstUserView];
self.viewArray = @[self.firstUserView, self.secondUserView, self.thirdUserView, self.fourthUserView, self.fifthUserView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(25);
make.left.mas_equalTo(self.stackView.mas_left);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.bottom.mas_equalTo(self);
}];
[self.addButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(25);
}];
[self.userView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(0);
}];
}
#pragma mark - Event Response
- (void)addButtonAction:(UIButton *)sender {
}
#pragma mark - Getters And Setters
- (void)setUserArray:(NSArray *)userArray {
_userArray = userArray;
if (_userArray.count > 0) {
self.userView.hidden = NO;
self.addButton.hidden = YES;
for (int i = 0 ; i< self.viewArray.count; i++) {
NetImageView * view = [self.viewArray objectAtIndex:i];
if (i < self.userArray.count) {
view.hidden = YES;
} else {
view.hidden = NO;
}
}
CGFloat userViewWidth = (_userArray.count - 1) * 15 + 25;
[self.userView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(userViewWidth);
}];
} else {
self.userView.hidden = YES;
self.addButton.hidden = NO;
}
}
- (void)setType:(GroupType)type {
_type = type;
if (_type == GroupTyp_red) {
CGColorRef color = UIColorFromRGB(0xFFA572).CGColor;
self.firstUserView.layer.borderColor = color;
self.secondUserView.layer.borderColor = color;
self.thirdUserView.layer.borderColor = color;
self.fourthUserView.layer.borderColor = color;
self.fifthUserView.layer.borderColor = color;
[self.addButton setImage:[UIImage imageNamed:@"room_pk_progrss_red_add"] forState:UIControlStateNormal];
[self.firstUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(25, 25));
make.right.centerY.mas_equalTo(self.userView);
}];
[self.secondUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.left.mas_equalTo(self.firstUserView.mas_left).offset(-5);
}];
[self.thirdUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.left.mas_equalTo(self.secondUserView.mas_left).offset(-5);
}];
[self.fourthUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.left.mas_equalTo(self.secondUserView.mas_left).offset(-5);
}];
[self.fifthUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.left.mas_equalTo(self.fourthUserView.mas_left).offset(-5);
}];
} else {
CGColorRef color = UIColorFromRGB(0x3ECAFC).CGColor;
self.firstUserView.layer.borderColor = color;
self.secondUserView.layer.borderColor = color;
self.thirdUserView.layer.borderColor = color;
self.fourthUserView.layer.borderColor = color;
self.fifthUserView.layer.borderColor = color;
[self.addButton setImage:[UIImage imageNamed:@"room_pk_progrss_blue_add"] forState:UIControlStateNormal];
[self.firstUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(25, 25));
make.left.centerY.mas_equalTo(self.userView);
}];
[self.secondUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.left.mas_equalTo(self.firstUserView.mas_left).offset(5);
}];
[self.thirdUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.right.mas_equalTo(self.secondUserView.mas_left).offset(5);
}];
[self.fourthUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.right.mas_equalTo(self.secondUserView.mas_left).offset(5);
}];
[self.fifthUserView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.centerY.mas_equalTo(self.firstUserView);
make.right.mas_equalTo(self.fourthUserView.mas_left).offset(5);
}];
}
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisHorizontal;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 0;
}
return _stackView;
}
- (UIView *)userView {
if (!_userView) {
_userView = [[UIView alloc] init];
_userView.backgroundColor = [UIColor clearColor];
_userView.hidden = YES;
}
return _userView;
}
- (NetImageView *)firstUserView {
if (!_firstUserView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_firstUserView = [[NetImageView alloc] initWithConfig:config];
_firstUserView.layer.masksToBounds = YES;
_firstUserView.layer.cornerRadius = 25/2;
_firstUserView.layer.borderWidth = 1;
}
return _firstUserView;
}
- (NetImageView *)secondUserView {
if (!_secondUserView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_secondUserView = [[NetImageView alloc] initWithConfig:config];
_secondUserView.layer.masksToBounds = YES;
_secondUserView.layer.cornerRadius = 25/2;
_secondUserView.layer.borderWidth = 1;
}
return _secondUserView;
}
- (NetImageView *)thirdUserView {
if (!_thirdUserView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_thirdUserView = [[NetImageView alloc] initWithConfig:config];
_thirdUserView.layer.masksToBounds = YES;
_thirdUserView.layer.cornerRadius = 25/2;
_thirdUserView.layer.borderWidth = 1;
}
return _thirdUserView;
}
- (NetImageView *)fourthUserView {
if (!_fourthUserView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_fourthUserView = [[NetImageView alloc] initWithConfig:config];
_fourthUserView.layer.masksToBounds = YES;
_fourthUserView.layer.cornerRadius = 25/2;
_fourthUserView.layer.borderWidth = 1;
}
return _fourthUserView;
}
- (NetImageView *)fifthUserView {
if (!_fifthUserView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_fifthUserView = [[NetImageView alloc] initWithConfig:config];
_fifthUserView.layer.masksToBounds = YES;
_fifthUserView.layer.cornerRadius = 25/2;
_fifthUserView.layer.borderWidth = 1;
}
return _fifthUserView;
}
- (UIButton *)addButton {
if (!_addButton) {
_addButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_addButton addTarget:self action:@selector(addButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _addButton;
}
@end

View File

@@ -0,0 +1,16 @@
//
// XPRoomPKProgressView.h
// xplan-ios
//
// Created by 冯硕 on 2022/3/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPRoomPKProgressView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,270 @@
//
// XPRoomPKProgressView.m
// xplan-ios
//
// Created by on 2022/3/28.
//
#import "XPRoomPKProgressView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
///View
#import "XPRoomPKPanelUserView.h"
@interface XPRoomPKProgressView ()
///
@property (nonatomic,strong) UIImageView *backImageView;
///
@property (nonatomic,strong) UIButton *beginButton;
///
@property (nonatomic,strong) UILabel *timeLabel;
///
@property (nonatomic,strong) XPRoomPKPanelUserView * redTeamView;
///
@property (nonatomic,strong) UILabel *redScoreLabel;
///
@property (nonatomic,strong) XPRoomPKPanelUserView * blueTeamView;
///
@property (nonatomic,strong) UILabel *blueScoreLabel;
///
@property (nonatomic,strong) UIView * progressView;
///
@property (nonatomic,strong) UIImageView * redProgressView;
///
@property (nonatomic,strong) UIImageView * blueProgressView;
///线
@property (nonatomic,strong) UIImageView *progressLineView;
@end
@implementation XPRoomPKProgressView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
[self addSubview:self.beginButton];
[self.backImageView addSubview:self.timeLabel];
[self.backImageView addSubview:self.redTeamView];
[self.backImageView addSubview:self.redScoreLabel];
[self.backImageView addSubview:self.blueTeamView];
[self.backImageView addSubview:self.blueScoreLabel];
[self.backImageView addSubview:self.progressView];
[self.progressView addSubview:self.redProgressView];
[self.progressView addSubview:self.blueProgressView];
[self.progressView addSubview:self.progressLineView];
self.redTeamView.userArray = @[@"1", @"2", @"222"];
self.blueTeamView.userArray = @[@"222", @"333"];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(260);
make.bottom.mas_equalTo(self.beginButton.mas_bottom);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(260, 60));
make.top.left.mas_equalTo(self);
}];
[self.beginButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(90, 24));
make.centerX.mas_equalTo(self.backImageView);
make.centerY.mas_equalTo(self.backImageView.mas_bottom);
}];
[self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView);
}];
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(85 * 2);
make.height.mas_equalTo(7);
make.centerX.mas_equalTo(self.backImageView);
make.top.mas_equalTo(self.backImageView).offset(23);
}];
[self.redTeamView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.progressView.mas_left);
make.centerY.mas_equalTo(self.progressView);;
}];
[self.blueTeamView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.progressView.mas_right);
make.centerY.mas_equalTo(self.progressView);
}];
[self.redProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.bottom.mas_equalTo(self.progressView);
make.width.mas_equalTo(85);
}];
[self.blueProgressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.bottom.mas_equalTo(self.progressView);
make.left.mas_equalTo(self.redProgressView.mas_right);
}];
[self.progressLineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(2.5, 12.5));
make.centerX.mas_equalTo(self.blueProgressView.mas_left).offset(-1.2);
make.centerY.mas_equalTo(self.progressView);
}];
[self.redScoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.redTeamView);
make.top.mas_equalTo(self.redTeamView.mas_bottom).offset(5);
make.left.mas_lessThanOrEqualTo(self.backImageView);
}];
[self.blueScoreLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.blueTeamView);
make.centerY.mas_equalTo(self.redScoreLabel);
make.right.mas_lessThanOrEqualTo(self.backImageView);
}];
}
#pragma mark - Event Response
- (void)redAddButtonAction:(UIButton *)sender {
}
- (void)blueAddButtonAction:(UIButton *)sender {
}
- (void)beginButtonAction:(UIButton *)sender {
}
#pragma mark - Getters And Setters
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"room_pk_progrss_bg"];
}
return _backImageView;
}
- (UILabel *)timeLabel {
if (!_timeLabel) {
_timeLabel = [[UILabel alloc] init];
_timeLabel.font = [UIFont systemFontOfSize:10];
_timeLabel.textColor = UIColorFromRGB(0x602A06);
_timeLabel.textAlignment = NSTextAlignmentCenter;
_timeLabel.text= @"00:00";
}
return _timeLabel;
}
- (XPRoomPKPanelUserView *)redTeamView {
if (!_redTeamView) {
_redTeamView = [[XPRoomPKPanelUserView alloc] init];
_redTeamView.type = GroupTyp_red;
}
return _redTeamView;
}
- (XPRoomPKPanelUserView *)blueTeamView {
if (!_blueTeamView) {
_blueTeamView = [[XPRoomPKPanelUserView alloc] init];
_blueTeamView.type = GroupType_Blue;
}
return _blueTeamView;
}
- (UIView *)progressView {
if (!_progressView) {
_progressView = [[UIView alloc] init];
_progressView.backgroundColor = [UIColor clearColor];
}
return _progressView;
}
- (UIImageView *)redProgressView {
if (!_redProgressView) {
_redProgressView = [[UIImageView alloc] init];
_redProgressView.userInteractionEnabled = YES;
_redProgressView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFA96AE), UIColorFromRGB(0xE943F8)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
_redProgressView.contentMode = UIViewContentModeScaleAspectFill;
_redProgressView.layer.masksToBounds = YES;
}
return _redProgressView;
}
- (UIImageView *)blueProgressView {
if (!_blueProgressView) {
_blueProgressView = [[UIImageView alloc] init];
_blueProgressView.userInteractionEnabled = YES;
_blueProgressView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x4F7AFF), UIColorFromRGB(0x44C0FE)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
_blueProgressView.contentMode = UIViewContentModeScaleAspectFill;
_blueProgressView.layer.masksToBounds = YES;
}
return _blueProgressView;
}
- (UIImageView *)progressLineView {
if (!_progressLineView) {
_progressLineView = [[UIImageView alloc] init];
_progressLineView.userInteractionEnabled = YES;
_progressLineView.image = [UIImage imageNamed:@"room_pk_progrss_line_bg"];
}
return _progressLineView;
}
- (UILabel *)redScoreLabel {
if (!_redScoreLabel) {
_redScoreLabel = [[UILabel alloc] init];
_redScoreLabel.text = @"0";
_redScoreLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_redScoreLabel.textColor = UIColor.whiteColor;
_redScoreLabel.textAlignment = NSTextAlignmentCenter;
}
return _redScoreLabel;
}
- (UILabel *)blueScoreLabel {
if (!_blueScoreLabel) {
_blueScoreLabel = [[UILabel alloc] init];
_blueScoreLabel.text = @"0";
_blueScoreLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
_blueScoreLabel.textColor = UIColor.whiteColor;
_blueScoreLabel.textAlignment = NSTextAlignmentCenter;
}
return _blueScoreLabel;
}
- (UIButton *)beginButton {
if (!_beginButton) {
_beginButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_beginButton setTitle:@"开始PK" forState:UIControlStateNormal];
[_beginButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_beginButton.titleLabel.font = [UIFont systemFontOfSize:15];
[_beginButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xFFDAA8), UIColorFromRGB(0xFFBD64)] gradientType:GradientTypeUpleftToLowright imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
_beginButton.layer.masksToBounds = YES;
_beginButton.layer.cornerRadius = 12;
[_beginButton addTarget:self action:@selector(beginButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _beginButton;
}
@end