个播PK弹窗
This commit is contained in:
@@ -124,6 +124,13 @@
|
||||
9B1B729828002147003FACE9 /* XPMineFansTeamPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B729728002147003FACE9 /* XPMineFansTeamPresenter.m */; };
|
||||
9B1B729D28002264003FACE9 /* XPMineAnchorFansTeamModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B729C28002264003FACE9 /* XPMineAnchorFansTeamModel.m */; };
|
||||
9B1B72A1280023F3003FACE9 /* XPMineAnchorFansTeamTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72A0280023F3003FACE9 /* XPMineAnchorFansTeamTableViewCell.m */; };
|
||||
9B1B72AC280031DB003FACE9 /* XPAnchorPKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72AB280031DB003FACE9 /* XPAnchorPKViewController.m */; };
|
||||
9B1B72AF280031F8003FACE9 /* XPAnchorPKSelectRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72AE280031F8003FACE9 /* XPAnchorPKSelectRoomView.m */; };
|
||||
9B1B72B22800343F003FACE9 /* AnchorPKInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72B12800343F003FACE9 /* AnchorPKInfoModel.m */; };
|
||||
9B1B72B528003664003FACE9 /* Api+AnchorPk.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72B428003664003FACE9 /* Api+AnchorPk.m */; };
|
||||
9B1B72B828003772003FACE9 /* XPAnchorPKPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72B728003772003FACE9 /* XPAnchorPKPresenter.m */; };
|
||||
9B1B72BC28003E06003FACE9 /* XPAnchorPKTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72BB28003E06003FACE9 /* XPAnchorPKTableViewCell.m */; };
|
||||
9B1B72BF2800422E003FACE9 /* XPAnchorPKRuleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1B72BE2800422E003FACE9 /* XPAnchorPKRuleView.m */; };
|
||||
9B1EF3D227E81C0600554295 /* XPMineDressUpBubbleViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1EF3D127E81C0600554295 /* XPMineDressUpBubbleViewController.m */; };
|
||||
9B1EF3D527E8294B00554295 /* XPMineDressEmptyCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1EF3D427E8294B00554295 /* XPMineDressEmptyCollectionViewCell.m */; };
|
||||
9B1FC3D527E49A5D006EFFE0 /* ChatBubbleModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B1FC3D427E49A5D006EFFE0 /* ChatBubbleModel.m */; };
|
||||
@@ -849,6 +856,21 @@
|
||||
9B1B729C28002264003FACE9 /* XPMineAnchorFansTeamModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineAnchorFansTeamModel.m; sourceTree = "<group>"; };
|
||||
9B1B729F280023F3003FACE9 /* XPMineAnchorFansTeamTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineAnchorFansTeamTableViewCell.h; sourceTree = "<group>"; };
|
||||
9B1B72A0280023F3003FACE9 /* XPMineAnchorFansTeamTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineAnchorFansTeamTableViewCell.m; sourceTree = "<group>"; };
|
||||
9B1B72AA280031DB003FACE9 /* XPAnchorPKViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKViewController.h; sourceTree = "<group>"; };
|
||||
9B1B72AB280031DB003FACE9 /* XPAnchorPKViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKViewController.m; sourceTree = "<group>"; };
|
||||
9B1B72AD280031F8003FACE9 /* XPAnchorPKSelectRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKSelectRoomView.h; sourceTree = "<group>"; };
|
||||
9B1B72AE280031F8003FACE9 /* XPAnchorPKSelectRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKSelectRoomView.m; sourceTree = "<group>"; };
|
||||
9B1B72B02800343F003FACE9 /* AnchorPKInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorPKInfoModel.h; sourceTree = "<group>"; };
|
||||
9B1B72B12800343F003FACE9 /* AnchorPKInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorPKInfoModel.m; sourceTree = "<group>"; };
|
||||
9B1B72B328003664003FACE9 /* Api+AnchorPk.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+AnchorPk.h"; sourceTree = "<group>"; };
|
||||
9B1B72B428003664003FACE9 /* Api+AnchorPk.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+AnchorPk.m"; sourceTree = "<group>"; };
|
||||
9B1B72B628003772003FACE9 /* XPAnchorPKPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKPresenter.h; sourceTree = "<group>"; };
|
||||
9B1B72B728003772003FACE9 /* XPAnchorPKPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKPresenter.m; sourceTree = "<group>"; };
|
||||
9B1B72B9280037C5003FACE9 /* XPAnchorPKProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKProtocol.h; sourceTree = "<group>"; };
|
||||
9B1B72BA28003E06003FACE9 /* XPAnchorPKTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKTableViewCell.h; sourceTree = "<group>"; };
|
||||
9B1B72BB28003E06003FACE9 /* XPAnchorPKTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKTableViewCell.m; sourceTree = "<group>"; };
|
||||
9B1B72BD2800422E003FACE9 /* XPAnchorPKRuleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKRuleView.h; sourceTree = "<group>"; };
|
||||
9B1B72BE2800422E003FACE9 /* XPAnchorPKRuleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKRuleView.m; sourceTree = "<group>"; };
|
||||
9B1EF3D027E81C0600554295 /* XPMineDressUpBubbleViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressUpBubbleViewController.h; sourceTree = "<group>"; };
|
||||
9B1EF3D127E81C0600554295 /* XPMineDressUpBubbleViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPMineDressUpBubbleViewController.m; sourceTree = "<group>"; };
|
||||
9B1EF3D327E8294B00554295 /* XPMineDressEmptyCollectionViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPMineDressEmptyCollectionViewCell.h; sourceTree = "<group>"; };
|
||||
@@ -2555,6 +2577,84 @@
|
||||
path = AnchorFansTeam;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A228002F76003FACE9 /* AnchorPK */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72A9280031A2003FACE9 /* Protocol */,
|
||||
9B1B72A82800319B003FACE9 /* Presenter */,
|
||||
9B1B72A528003185003FACE9 /* View */,
|
||||
9B1B72A42800317F003FACE9 /* Api */,
|
||||
9B1B72A328003153003FACE9 /* Model */,
|
||||
);
|
||||
path = AnchorPK;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A328003153003FACE9 /* Model */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72B02800343F003FACE9 /* AnchorPKInfoModel.h */,
|
||||
9B1B72B12800343F003FACE9 /* AnchorPKInfoModel.m */,
|
||||
);
|
||||
path = Model;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A42800317F003FACE9 /* Api */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72B328003664003FACE9 /* Api+AnchorPk.h */,
|
||||
9B1B72B428003664003FACE9 /* Api+AnchorPk.m */,
|
||||
);
|
||||
path = Api;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A528003185003FACE9 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72A728003196003FACE9 /* Cell */,
|
||||
9B1B72A62800318A003FACE9 /* SubViews */,
|
||||
9B1B72AA280031DB003FACE9 /* XPAnchorPKViewController.h */,
|
||||
9B1B72AB280031DB003FACE9 /* XPAnchorPKViewController.m */,
|
||||
9B1B72AD280031F8003FACE9 /* XPAnchorPKSelectRoomView.h */,
|
||||
9B1B72AE280031F8003FACE9 /* XPAnchorPKSelectRoomView.m */,
|
||||
);
|
||||
path = View;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A62800318A003FACE9 /* SubViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72BD2800422E003FACE9 /* XPAnchorPKRuleView.h */,
|
||||
9B1B72BE2800422E003FACE9 /* XPAnchorPKRuleView.m */,
|
||||
);
|
||||
path = SubViews;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A728003196003FACE9 /* Cell */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72BA28003E06003FACE9 /* XPAnchorPKTableViewCell.h */,
|
||||
9B1B72BB28003E06003FACE9 /* XPAnchorPKTableViewCell.m */,
|
||||
);
|
||||
path = Cell;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A82800319B003FACE9 /* Presenter */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72B628003772003FACE9 /* XPAnchorPKPresenter.h */,
|
||||
9B1B72B728003772003FACE9 /* XPAnchorPKPresenter.m */,
|
||||
);
|
||||
path = Presenter;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B1B72A9280031A2003FACE9 /* Protocol */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72B9280037C5003FACE9 /* XPAnchorPKProtocol.h */,
|
||||
);
|
||||
path = Protocol;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9B208A372779C1EF00F9E54A /* FaceView */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@@ -4389,6 +4489,7 @@
|
||||
E8AEAED8271413530017FCE0 /* View */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9B1B72A228002F76003FACE9 /* AnchorPK */,
|
||||
9B92C01A27E0BAEB0044C5EA /* NobleTrumpet */,
|
||||
9B7B605827BB52FD0070BB72 /* AnchorView */,
|
||||
E81EF6D9279AB59100FF3EDE /* LittleGame */,
|
||||
@@ -5292,6 +5393,7 @@
|
||||
E824545E26F5EF2200BE8163 /* XPMineVerifIdentityProtocol.h in Sources */,
|
||||
E824545326F5CEAD00BE8163 /* XPMineModifPayProtocol.h in Sources */,
|
||||
E84BF7D7277C6E2100EF8877 /* XPRoomRoleViewController.m in Sources */,
|
||||
9B1B72B22800343F003FACE9 /* AnchorPKInfoModel.m in Sources */,
|
||||
E824544826F5945300BE8163 /* XPMinePayPwdProtocol.h in Sources */,
|
||||
E824543A26F5880E00BE8163 /* XPLoginVerifBindPhoneProtocol.h in Sources */,
|
||||
E824543826F5820A00BE8163 /* XPLoginVerifBindPhonePresenter.m in Sources */,
|
||||
@@ -5410,6 +5512,7 @@
|
||||
E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */,
|
||||
E81AF31A27F19265003B9E43 /* XPHomeGradientLabel.m in Sources */,
|
||||
E8AC722F26F49610007D6E91 /* XPMineNotificationItemModel.m in Sources */,
|
||||
9B1B72BC28003E06003FACE9 /* XPAnchorPKTableViewCell.m in Sources */,
|
||||
E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */,
|
||||
E8A1E45B27620F4900B294CA /* XPRoomHalfWebView.m in Sources */,
|
||||
9B7D80562753C595003DAC0C /* SendMessageView.m in Sources */,
|
||||
@@ -5478,6 +5581,7 @@
|
||||
9B85B6DA279FDC5200A0A1AC /* XPUserCardSkillCollectionViewCell.m in Sources */,
|
||||
189DD68426E1FDBB00AB55B1 /* XCHUDTool.m in Sources */,
|
||||
E8A6C29B27CF53BF00AC7442 /* XPHomeLikePresenter.m in Sources */,
|
||||
9B1B72AF280031F8003FACE9 /* XPAnchorPKSelectRoomView.m in Sources */,
|
||||
E8D4824A278D1F73003C1D08 /* XPAcrossRoomPKInviteView.m in Sources */,
|
||||
189DD73F26E21C3F00AB55B1 /* YYUtility+Carrier.m in Sources */,
|
||||
E87AE7F9277AABE50037823A /* XPRoomTagListViewController.m in Sources */,
|
||||
@@ -5503,6 +5607,7 @@
|
||||
E8B846C226FD82DC00A777FE /* XPMineUserInfoAlbumCollectionViewCell.m in Sources */,
|
||||
E816C11527608A7500C84014 /* XPRoomMiniManager.m in Sources */,
|
||||
E8EEB91726FC7B35007C6EBA /* XPMineUserInfoDesViewController.m in Sources */,
|
||||
9B1B72AC280031DB003FACE9 /* XPAnchorPKViewController.m in Sources */,
|
||||
E80CBDED27D0D899001E1EC2 /* XPHomeLikeEmptyTableViewCell.m in Sources */,
|
||||
180806FB2729A354001FD836 /* ThemeColor+Room.m in Sources */,
|
||||
E8395331276A03AE00CF2F24 /* Api+DressUp.m in Sources */,
|
||||
@@ -5531,6 +5636,7 @@
|
||||
E899C68927508F4E00E189E5 /* XPUserCardInfoModel.m in Sources */,
|
||||
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */,
|
||||
E8A03DE9276301CC0098D9EA /* XPCandyRankContainerView.m in Sources */,
|
||||
9B1B72BF2800422E003FACE9 /* XPAnchorPKRuleView.m in Sources */,
|
||||
186A534B26FC6ED900D67B2C /* TTPopupManagerService.m in Sources */,
|
||||
18E7B1B226E8AF980064BC9B /* MainPresenter.m in Sources */,
|
||||
E81366F626F0C0DF0076364C /* LoginFullInfoPresenter.m in Sources */,
|
||||
@@ -5552,10 +5658,12 @@
|
||||
E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */,
|
||||
E874B88B27215EAF003954B9 /* MicroQueueModel.m in Sources */,
|
||||
9B92A3662798132600AD168F /* XPSkillCardTypeView.m in Sources */,
|
||||
9B1B72B828003772003FACE9 /* XPAnchorPKPresenter.m in Sources */,
|
||||
E8EE827D272B9A2300A17217 /* XPRoomSendTextView.m in Sources */,
|
||||
9BD63FAE277EE97A006EB744 /* XPReleaseRadioPresenter.m in Sources */,
|
||||
9B1FC3D827E49C36006EFFE0 /* XPMineDressBubbleCollectionViewCell.m in Sources */,
|
||||
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */,
|
||||
9B1B72B528003664003FACE9 /* Api+AnchorPk.m in Sources */,
|
||||
E8EEB90626FC5772007C6EBA /* XPMineUserInfoEditViewController.m in Sources */,
|
||||
E8B846D626FDE01B00A777FE /* XPMineRechargePresenter.m in Sources */,
|
||||
E8EEB91426FC7786007C6EBA /* XPMineUserInfoNickViewController.m in Sources */,
|
||||
|
54
xplan-ios/Main/Room/View/AnchorPK/Api/Api+AnchorPk.h
Normal file
54
xplan-ios/Main/Room/View/AnchorPK/Api/Api+AnchorPk.h
Normal file
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// Api+AnchorPk.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "Api.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface Api (AnchorPk)
|
||||
|
||||
/// 搜索PK的房间列表
|
||||
/// @param completion 完成
|
||||
/// @param erbanNo 要搜索的房主的id
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param pageNum 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)searchAnchorPKRoomList:(HttpRequestHelperCompletion)completion
|
||||
erbanNo:(NSString *)erbanNo
|
||||
roomUid:(NSString *)roomUid
|
||||
pageNum:(NSString *)pageNum
|
||||
pageSize:(NSString *)pageSize
|
||||
pkType:(NSString *)pkType;
|
||||
|
||||
/// 获取可以PK的房间列表
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param pageNum 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)getAnchorPKRoomList:(HttpRequestHelperCompletion)completion
|
||||
roomUid:(NSString *)roomUid
|
||||
pageNum:(NSString *)pageNum
|
||||
pageSize:(NSString *)pageSize
|
||||
pkType:(NSString *)pkType;
|
||||
|
||||
/// 开启一轮PK
|
||||
/// @param completion 完成
|
||||
/// @param acceptUid pk对方的uid
|
||||
/// @param duration 持续的时间 分钟
|
||||
/// @param inviteUid 邀请房间的房主的id
|
||||
/// @param operateUid 操作者的uid
|
||||
/// @param playDesc 描述
|
||||
+ (void)beginAnchorPK:(HttpRequestHelperCompletion)completion
|
||||
acceptUid:(NSString *)acceptUid
|
||||
duration:(NSString *)duration
|
||||
inviteUid:(NSString *)inviteUid
|
||||
operateUid:(NSString *)operateUid
|
||||
playDesc:(NSString *)playDesc;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
42
xplan-ios/Main/Room/View/AnchorPK/Api/Api+AnchorPk.m
Normal file
42
xplan-ios/Main/Room/View/AnchorPK/Api/Api+AnchorPk.m
Normal file
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// Api+AnchorPk.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "Api+AnchorPk.h"
|
||||
|
||||
@implementation Api (AnchorPk)
|
||||
|
||||
/// 搜索PK的房间列表
|
||||
/// @param completion 完成
|
||||
/// @param erbanNo 要搜索的房主的id
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param pageNum 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)searchAnchorPKRoomList:(HttpRequestHelperCompletion)completion erbanNo:(NSString *)erbanNo roomUid:(NSString *)roomUid pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize pkType:(NSString *)pkType {
|
||||
[self makeRequest:@"search/permitRoom" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, erbanNo, roomUid, pageNum, pageSize, pkType, nil];
|
||||
}
|
||||
|
||||
/// 获取可以PK的房间列表
|
||||
/// @param completion 完成
|
||||
/// @param roomUid 房主的uid
|
||||
/// @param pageNum 当前的页数
|
||||
/// @param pageSize 一页多少个
|
||||
+ (void)getAnchorPKRoomList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize pkType:(NSString *)pkType {
|
||||
[self makeRequest:@"search/permitRoom" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, roomUid, pageNum, pageSize, pkType, nil];
|
||||
}
|
||||
|
||||
/// 开启一轮PK
|
||||
/// @param completion 完成
|
||||
/// @param acceptUid pk对方的uid
|
||||
/// @param duration 持续的时间 分钟
|
||||
/// @param inviteUid 邀请房间的房主的id
|
||||
/// @param operateUid 操作者的uid
|
||||
/// @param playDesc 描述
|
||||
+ (void)beginAnchorPK:(HttpRequestHelperCompletion)completion acceptUid:(NSString *)acceptUid duration:(NSString *)duration inviteUid:(NSString *)inviteUid operateUid:(NSString *)operateUid playDesc:(NSString *)playDesc {
|
||||
[self makeRequest:@"crossroompkround/initiateChallenge" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, acceptUid, duration, inviteUid, operateUid, playDesc, nil];
|
||||
}
|
||||
|
||||
@end
|
29
xplan-ios/Main/Room/View/AnchorPK/Model/AnchorPKInfoModel.h
Normal file
29
xplan-ios/Main/Room/View/AnchorPK/Model/AnchorPKInfoModel.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// AnchorPKInfoModel.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface AnchorPKInfoModel : NSObject
|
||||
|
||||
@property (nonatomic, copy) NSString * roomId;
|
||||
@property (nonatomic, copy) NSString * uid;
|
||||
@property (nonatomic, copy) NSString * roomUid;
|
||||
@property (nonatomic, copy) NSString *title;
|
||||
///头像
|
||||
@property (nonatomic, copy) NSString *avatar;
|
||||
///昵称
|
||||
@property (nonatomic, copy) NSString *nick;
|
||||
///二般号
|
||||
@property (nonatomic, copy) NSString * erbanNo;
|
||||
///是否选中
|
||||
@property (nonatomic, assign) BOOL hadSelected;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
12
xplan-ios/Main/Room/View/AnchorPK/Model/AnchorPKInfoModel.m
Normal file
12
xplan-ios/Main/Room/View/AnchorPK/Model/AnchorPKInfoModel.m
Normal file
@@ -0,0 +1,12 @@
|
||||
//
|
||||
// AnchorPKInfoModel.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "AnchorPKInfoModel.h"
|
||||
|
||||
@implementation AnchorPKInfoModel
|
||||
|
||||
@end
|
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// XPAnchorPKPresenter.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "BaseMvpPresenter.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAnchorPKPresenter : BaseMvpPresenter
|
||||
|
||||
/// 开启主播PK
|
||||
/// @param roomUid 当前房间的房主uid
|
||||
/// @param duration 持续的时间
|
||||
/// @param acceptUid 接收者的uid
|
||||
/// @param playDesc 玩法
|
||||
- (void)beginAnchorPK:(NSString *)roomUid duration:(NSInteger)duration acceptUid:(NSString *)acceptUid playDesc:(NSString *)playDesc;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// XPAnchorPKPresenter.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "XPAnchorPKPresenter.h"
|
||||
#import "Api+AnchorPk.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
#import "XPAnchorPKProtocol.h"
|
||||
|
||||
@implementation XPAnchorPKPresenter
|
||||
|
||||
/// 开启主播PK
|
||||
/// @param roomUid 当前房间的房主uid
|
||||
/// @param duration 持续的时间
|
||||
/// @param acceptUid 接收者的uid
|
||||
/// @param playDesc 玩法
|
||||
- (void)beginAnchorPK:(NSString *)roomUid duration:(NSInteger)duration acceptUid:(NSString *)acceptUid playDesc:(NSString *)playDesc {
|
||||
NSString * uid = [AccountInfoStorage instance].getUid;
|
||||
NSString * time = [NSString stringWithFormat:@"%ld", duration];
|
||||
[Api beginAnchorPK:[self createHttpCompletion:^(BaseModel * _Nonnull data) {
|
||||
[[self getView] beginAnchorPKSuccess];
|
||||
}fail:^(NSInteger code, NSString * _Nullable msg) {
|
||||
[[self getView] beginAnchorPKFail:msg];
|
||||
} showLoading:YES errorToast:NO] acceptUid:acceptUid duration:time inviteUid:roomUid operateUid:uid playDesc:playDesc];
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// XPAnchorPKProtocol.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@protocol XPAnchorPKProtocol <NSObject>
|
||||
|
||||
///开启咵房pk成功
|
||||
- (void)beginAnchorPKSuccess;
|
||||
///开启跨房Pk失败
|
||||
- (void)beginAnchorPKFail:(NSString *)message;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// XPAnchorPKTableViewCell.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class AnchorPKInfoModel, XPAnchorPKTableViewCell;
|
||||
@protocol XPAnchorPKTableViewCellDelegate <NSObject>
|
||||
///点击了选择的按钮
|
||||
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AnchorPKInfoModel *)roomInfo;
|
||||
@end
|
||||
|
||||
@interface XPAnchorPKTableViewCell : UITableViewCell
|
||||
|
||||
@property (nonatomic,strong) AnchorPKInfoModel *roomPKInfo;
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPAnchorPKTableViewCellDelegate> delegate;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// XPAnchorPKTableViewCell.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "XPAnchorPKTableViewCell.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "UIImage+Utils.h"
|
||||
///Model
|
||||
#import "AnchorPKInfoModel.h"
|
||||
|
||||
@interface XPAnchorPKTableViewCell()
|
||||
|
||||
///头像
|
||||
@property (nonatomic, strong) NetImageView *avatarImageView;
|
||||
///选择的
|
||||
@property (nonatomic, strong) UIButton *selectButton;
|
||||
///名字
|
||||
@property (nonatomic, strong) UILabel *nameLabel;
|
||||
///大鹅号
|
||||
@property (nonatomic, strong) UILabel *idLabel;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAnchorPKTableViewCell
|
||||
|
||||
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
|
||||
if (self) {
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
#pragma mark - Private Method
|
||||
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = [UIColor clearColor];
|
||||
self.selectionStyle = UITableViewCellSelectionStyleNone;
|
||||
[self.contentView addSubview:self.avatarImageView];
|
||||
[self.contentView addSubview:self.nameLabel];
|
||||
[self.contentView addSubview:self.idLabel];
|
||||
[self.contentView addSubview:self.selectButton];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(13);
|
||||
make.width.height.mas_equalTo(60);
|
||||
make.centerY.mas_equalTo(self.contentView);
|
||||
}];
|
||||
[self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(6);
|
||||
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY);
|
||||
make.height.mas_equalTo(14);
|
||||
make.right.mas_equalTo(self.selectButton.mas_left).mas_offset(-5);
|
||||
}];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.nameLabel);
|
||||
make.top.mas_equalTo(self.nameLabel.mas_bottom).mas_offset(7);
|
||||
}];
|
||||
|
||||
[self.selectButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-15);
|
||||
make.centerY.mas_equalTo(self.avatarImageView);
|
||||
make.width.mas_equalTo(64);
|
||||
make.height.mas_equalTo(24);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)selectButtonAction:(UIButton *)sender {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAnchorPKTableViewCell:didChooseRoom:)]) {
|
||||
[self.delegate xPAnchorPKTableViewCell:self didChooseRoom:self.roomPKInfo];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRoomPKInfo:(AnchorPKInfoModel *)roomPKInfo {
|
||||
_roomPKInfo = roomPKInfo;
|
||||
self.avatarImageView.imageUrl = _roomPKInfo.avatar;
|
||||
self.nameLabel.text = _roomPKInfo.title;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", _roomPKInfo.erbanNo];
|
||||
// self.selectButton.selected = _roomPKInfo.hadSelected;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 60/2;
|
||||
_avatarImageView.layer.borderWidth = 1;
|
||||
_avatarImageView.layer.borderColor = [UIColor whiteColor].CGColor;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UIButton *)selectButton {
|
||||
if (!_selectButton) {
|
||||
_selectButton = [[UIButton alloc] init];
|
||||
[_selectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_selectButton addTarget:self action:@selector(selectButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_selectButton.userInteractionEnabled = YES;
|
||||
_selectButton.layer.cornerRadius = 12;
|
||||
_selectButton.layer.masksToBounds = YES;
|
||||
[_selectButton setTitle:@"选择" forState:UIControlStateNormal];
|
||||
_selectButton.titleLabel.font = [UIFont systemFontOfSize:12];
|
||||
[_selectButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
}
|
||||
return _selectButton;
|
||||
}
|
||||
|
||||
- (UILabel *)nameLabel {
|
||||
if (!_nameLabel) {
|
||||
_nameLabel = [[UILabel alloc] init];
|
||||
_nameLabel.textColor = [UIColor whiteColor];
|
||||
_nameLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _nameLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)idLabel {
|
||||
if (!_idLabel) {
|
||||
_idLabel = [[UILabel alloc] init];
|
||||
_idLabel.textColor = [UIColor whiteColor];
|
||||
_idLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _idLabel;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,16 @@
|
||||
//
|
||||
// XPAnchorPKRuleView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAnchorPKRuleView : UIView
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// XPAnchorPKRuleView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "XPAnchorPKRuleView.h"
|
||||
|
||||
@implementation XPAnchorPKRuleView
|
||||
|
||||
/*
|
||||
// Only override drawRect: if you perform custom drawing.
|
||||
// An empty implementation adversely affects performance during animation.
|
||||
- (void)drawRect:(CGRect)rect {
|
||||
// Drawing code
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// XPAnchorPKSelectRoomView.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class XPAnchorPKSelectRoomView, AnchorPKInfoModel;
|
||||
@protocol XPAnchorPKSelectRoomViewDelegate <NSObject>
|
||||
|
||||
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AnchorPKInfoModel *)pkRoomInfo;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPAnchorPKSelectRoomView : UIView
|
||||
|
||||
///代理
|
||||
@property (nonatomic,weak) id<XPAnchorPKSelectRoomViewDelegate> delegate;
|
||||
///房间的uid
|
||||
@property (nonatomic,copy) NSString *roomUid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,337 @@
|
||||
//
|
||||
// XPAnchorPKSelectRoomView.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "XPAnchorPKSelectRoomView.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <MJRefresh/MJRefresh.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "XCHudTool.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "Api+AnchorPk.h"
|
||||
#import "XPMacro.h"
|
||||
///Model
|
||||
#import "AnchorPKInfoModel.h"
|
||||
///View
|
||||
#import "XPAcrossRoomPKEmptyTableViewCell.h"
|
||||
#import "XPAnchorPKTableViewCell.h"
|
||||
|
||||
@interface XPAnchorPKSelectRoomView ()<UITableViewDelegate, UITableViewDataSource, XPAnchorPKTableViewCellDelegate>
|
||||
|
||||
///返回按钮
|
||||
@property (nonatomic, strong) UIButton *backButton;
|
||||
@property (nonatomic, strong) UITableView *tableView;
|
||||
///输入框背景
|
||||
@property (nonatomic,strong) UIView * inputBackView;
|
||||
///搜索logo
|
||||
@property (nonatomic,strong) UIButton *searchButton;
|
||||
///输入框
|
||||
@property (nonatomic,strong) UITextField *searchTextField;
|
||||
///数据源
|
||||
@property (nonatomic, strong) NSMutableArray *datasource;
|
||||
///当前的页数
|
||||
@property (nonatomic, assign) NSInteger page;
|
||||
///是否有更多的数据
|
||||
@property (nonatomic,assign) BOOL hasNoMoreData;
|
||||
///选中的PK房间
|
||||
@property (nonatomic, strong) AnchorPKInfoModel *selectRoomInfo;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAnchorPKSelectRoomView
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame {
|
||||
if (self = [super initWithFrame:frame]) {
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
[self initHeaderAndFooterRrfresh];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.backgroundColor = UIColorFromRGB(0x2A2A39);
|
||||
[self addSubview:self.backButton];
|
||||
[self addSubview:self.inputBackView];
|
||||
[self addSubview:self.tableView];
|
||||
|
||||
[self.inputBackView addSubview:self.searchButton];
|
||||
[self.inputBackView addSubview:self.searchTextField];
|
||||
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onKeyBoardResign:)];
|
||||
[self addGestureRecognizer:tap];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[self.backButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(12);
|
||||
make.width.mas_equalTo(22);
|
||||
make.height.mas_equalTo(22);
|
||||
make.top.mas_equalTo(27);
|
||||
}];
|
||||
|
||||
|
||||
[self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.inputBackView.mas_bottom).mas_offset(5);
|
||||
make.left.right.mas_equalTo(0);
|
||||
make.bottom.mas_equalTo(self.mas_bottom);
|
||||
}];
|
||||
[self.inputBackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(30);
|
||||
make.left.mas_equalTo(self.backButton.mas_right).offset(5);
|
||||
make.right.mas_equalTo(self.mas_right).offset(-15);
|
||||
make.centerY.mas_equalTo(self.backButton);
|
||||
}];
|
||||
|
||||
[self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(18, 18));
|
||||
make.centerY.mas_equalTo(self.inputBackView);
|
||||
make.right.mas_equalTo(self.inputBackView).offset(-12);
|
||||
}];
|
||||
|
||||
[self.searchTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.inputBackView).offset(25);
|
||||
make.top.bottom.mas_equalTo(self.inputBackView);
|
||||
make.right.mas_equalTo(self.searchButton.mas_left).offset(-5);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)initHeaderAndFooterRrfresh {
|
||||
MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)];
|
||||
header.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
header.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor];
|
||||
self.tableView.mj_header = header;
|
||||
|
||||
MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)];
|
||||
footer.stateLabel.textColor = [ThemeColor secondTextColor];
|
||||
footer.stateLabel.font = [UIFont systemFontOfSize:10.0];
|
||||
self.tableView.mj_footer = footer;
|
||||
}
|
||||
|
||||
#pragma mark - 刷新的fangfa
|
||||
- (void)headerRefresh {
|
||||
self.page = 1;
|
||||
[Api getAnchorPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray * array = [AnchorPKInfoModel modelsWithArray:data.data];
|
||||
[self getAcrossRoomPKListSuccess:array state:0];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} roomUid:self.roomUid pageNum:[NSString stringWithFormat:@"%ld", self.page] pageSize:@"20" pkType:@"2"];
|
||||
}
|
||||
|
||||
- (void)footerRefresh {
|
||||
if (self.hasNoMoreData) {
|
||||
[XCHUDTool showErrorWithMessage:@"没有更多房间了"];
|
||||
return;
|
||||
}
|
||||
self.page++;
|
||||
[Api getAnchorPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray * array = [AnchorPKInfoModel modelsWithArray:data.data];
|
||||
[self getAcrossRoomPKListSuccess:array state:1];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} roomUid:self.roomUid pageNum:[NSString stringWithFormat:@"%ld", self.page] pageSize:@"20" pkType:@"2"];
|
||||
}
|
||||
|
||||
- (void)getAcrossRoomPKListSuccess:(NSArray *)list state:(int)state {
|
||||
if (state == 0) {
|
||||
self.selectRoomInfo = nil;
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
} else {
|
||||
[self.tableView.mj_footer endRefreshing];
|
||||
}
|
||||
if (list.count > 0) {
|
||||
self.hasNoMoreData = NO;
|
||||
[self.datasource addObjectsFromArray:list];
|
||||
} else {
|
||||
self.hasNoMoreData = YES;
|
||||
[self.tableView.mj_footer endRefreshingWithNoMoreData];
|
||||
}
|
||||
[self.tableView reloadData];
|
||||
}
|
||||
|
||||
- (void)onKeyBoardResign:(UITapGestureRecognizer *)ges {
|
||||
[self.searchTextField resignFirstResponder];
|
||||
}
|
||||
#pragma mark - tableviewDelegate
|
||||
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||
return self.datasource.count > 0 ? self.datasource.count : 1;
|
||||
}
|
||||
|
||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
XPAnchorPKTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPAnchorPKTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPAnchorPKTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAnchorPKTableViewCell class])];
|
||||
}
|
||||
cell.delegate = self;
|
||||
AnchorPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row];
|
||||
if (pkRoomInfo.uid.integerValue == self.selectRoomInfo.uid.integerValue) {
|
||||
pkRoomInfo.hadSelected = YES;
|
||||
} else {
|
||||
pkRoomInfo.hadSelected = NO;
|
||||
}
|
||||
cell.roomPKInfo = pkRoomInfo;
|
||||
return cell;
|
||||
}
|
||||
|
||||
XPAcrossRoomPKEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])];
|
||||
if (cell == nil) {
|
||||
cell = [[XPAcrossRoomPKEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])];
|
||||
}
|
||||
return cell;
|
||||
|
||||
}
|
||||
|
||||
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||
if (self.datasource.count > 0) {
|
||||
return 75;
|
||||
}
|
||||
return (370 + kSafeAreaBottomHeight);
|
||||
}
|
||||
|
||||
#pragma mark - XPAnchorPKTableViewCellDelegate
|
||||
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AnchorPKInfoModel *)roomInfo {
|
||||
// if (self.selectRoomInfo && roomInfo.uid == self.selectRoomInfo.uid) {///有选中的且点击了选中的,取消掉选择
|
||||
// [self.tableView reloadData];
|
||||
// self.selectRoomInfo = nil;
|
||||
// self.doneButton.enabled = NO;
|
||||
// } else {
|
||||
// [self.tableView reloadData];
|
||||
// self.doneButton.enabled = YES;
|
||||
// }
|
||||
|
||||
self.selectRoomInfo = roomInfo;
|
||||
[self.searchTextField resignFirstResponder];
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(XPAnchorPKSelectRoomView:didChoosePKRoom:)]) {
|
||||
[self.delegate XPAnchorPKSelectRoomView:self didChoosePKRoom:self.selectRoomInfo];
|
||||
}
|
||||
CATransition *transition = [CATransition animation];
|
||||
transition.duration = 0.3f;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionPush;
|
||||
transition.subtype = kCATransitionFromLeft;
|
||||
[self.layer addAnimation:transition forKey:nil];
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)searchButtonAction:(UIButton *)sender {
|
||||
if (self.searchTextField.text.length > 0) {
|
||||
[Api searchAnchorPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
NSArray * array = [AnchorPKInfoModel modelsWithArray:data.data];
|
||||
[self getAcrossRoomPKListSuccess:array state:0];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} erbanNo:self.searchTextField.text roomUid:@"" pageNum:@"1" pageSize:@"50" pkType:@"2"];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:@"请输入要搜索的厅大鹅号"];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)backButtonAction:(UIButton *)sender {
|
||||
[self.searchTextField resignFirstResponder];
|
||||
CATransition *transition = [CATransition animation];
|
||||
transition.duration = 0.3f;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionPush;
|
||||
transition.subtype = kCATransitionFromLeft;
|
||||
[self.layer addAnimation:transition forKey:nil];
|
||||
[self removeFromSuperview];
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (void)setRoomUid:(NSString *)roomUid {
|
||||
_roomUid = roomUid;
|
||||
[self.datasource removeAllObjects];
|
||||
[self.tableView reloadData];
|
||||
if (_roomUid.length > 0) {
|
||||
[self headerRefresh];
|
||||
}
|
||||
}
|
||||
- (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];
|
||||
if (@available(iOS 11.0, *)) {
|
||||
_tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
|
||||
}
|
||||
[_tableView registerClass:[XPAnchorPKTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPAnchorPKTableViewCell class])];
|
||||
[_tableView registerClass:[XPAcrossRoomPKEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])];
|
||||
}
|
||||
return _tableView;
|
||||
}
|
||||
|
||||
|
||||
- (UIView *)inputBackView {
|
||||
if (!_inputBackView) {
|
||||
_inputBackView = [[UIView alloc] init];
|
||||
_inputBackView.backgroundColor = UIColorFromRGB(0x4C4C6A);
|
||||
_inputBackView.layer.masksToBounds = YES;
|
||||
_inputBackView.layer.cornerRadius = 15;
|
||||
}
|
||||
return _inputBackView;
|
||||
}
|
||||
|
||||
- (UIButton *)searchButton {
|
||||
if (!_searchButton) {
|
||||
_searchButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_searchButton setImage:[UIImage imageNamed:@"home_search_input_search"] forState:UIControlStateNormal];
|
||||
[_searchButton setImage:[UIImage imageNamed:@"home_search_input_search"] forState:UIControlStateSelected];
|
||||
[_searchButton addTarget:self action:@selector(searchButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _searchButton;
|
||||
}
|
||||
|
||||
- (UITextField *)searchTextField {
|
||||
if (!_searchTextField) {
|
||||
_searchTextField = [[UITextField alloc] init];
|
||||
_searchTextField.layer.cornerRadius = 15;
|
||||
_searchTextField.layer.masksToBounds = YES;
|
||||
_searchTextField.tintColor = [UIColor whiteColor];
|
||||
_searchTextField.textColor = [UIColor whiteColor];
|
||||
_searchTextField.backgroundColor = [UIColor clearColor];
|
||||
_searchTextField.font = [UIFont systemFontOfSize:13];
|
||||
NSString *placeholder = [NSString stringWithFormat:@"请输入厅的大鹅号"];
|
||||
_searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:13], NSForegroundColorAttributeName : [UIColor colorWithWhite:1 alpha:0.4]}];
|
||||
}
|
||||
return _searchTextField;
|
||||
}
|
||||
|
||||
- (UIButton *)backButton {
|
||||
if (!_backButton) {
|
||||
_backButton = [[UIButton alloc] init];
|
||||
[_backButton setImage:[UIImage imageNamed:@"home_search_white_back"] forState:UIControlStateNormal];
|
||||
_backButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
|
||||
[_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _backButton;
|
||||
}
|
||||
|
||||
- (NSMutableArray *)datasource {
|
||||
if (!_datasource) {
|
||||
_datasource = [NSMutableArray array];
|
||||
}
|
||||
return _datasource;
|
||||
}
|
||||
|
||||
@end
|
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// XPAnchorPKViewController.h
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "MvpViewController.h"
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAnchorPKViewController : MvpViewController
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,673 @@
|
||||
//
|
||||
// XPAnchorPKViewController.m
|
||||
// xplan-ios
|
||||
//
|
||||
// Created by GreenLand on 2022/4/8.
|
||||
//
|
||||
|
||||
#import "XPAnchorPKViewController.h"
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
#import <IQKeyboardManager/IQKeyboardManager.h>
|
||||
///Tool
|
||||
#import "ThemeColor.h"
|
||||
#import "NetImageView.h"
|
||||
#import "XPMacro.h"
|
||||
#import "UIImage+Utils.h"
|
||||
#import "TTPopup.h"
|
||||
///Model
|
||||
#import "AnchorPKInfoModel.h"
|
||||
///View
|
||||
#import "XPAnchorPKSelectRoomView.h"
|
||||
#import "XPAcrossRoomPKRuleView.h"
|
||||
///P
|
||||
#import "XPAnchorPKPresenter.h"
|
||||
#import "XPAnchorPKProtocol.h"
|
||||
|
||||
#define kContentHeight (404 + kSafeAreaBottomHeight)
|
||||
|
||||
@interface XPAnchorPKViewController ()<UITextFieldDelegate, XPAnchorPKSelectRoomViewDelegate, XPAnchorPKProtocol>
|
||||
///顶部点击消失的view
|
||||
@property (nonatomic, strong) UIView *topView;
|
||||
///显示内容的view
|
||||
@property (nonatomic, strong) UIView *contentView;
|
||||
///标题
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///帮助
|
||||
@property (nonatomic, strong) UIButton *helpButton;
|
||||
///PK对象的容器
|
||||
@property (nonatomic,strong) UIStackView *userStackView;
|
||||
///选择PK对象title
|
||||
@property (nonatomic, strong) UILabel *selectPKLabel;
|
||||
///选择PK对象
|
||||
@property (nonatomic, strong) UIButton *selectPKButton;
|
||||
///PK对象的容器
|
||||
@property (nonatomic,strong) UIStackView *timeStackView;
|
||||
///选择PK时长title
|
||||
@property (nonatomic, strong) UILabel *selectPKTimeLabel;
|
||||
///选择PK时间的容器
|
||||
@property (nonatomic,strong) UIStackView *chooseTimeStackView;
|
||||
@property (nonatomic, strong) UIButton *tenMinuteButton;
|
||||
@property (nonatomic, strong) UIButton *twentyMinuteButton;
|
||||
@property (nonatomic, strong) UIButton *thirtyMinuteButton;
|
||||
///自定义PK时间
|
||||
@property (nonatomic, strong) UITextField *customTimeTextField;
|
||||
///玩法的容器
|
||||
@property (nonatomic,strong) UIStackView *playStackView;
|
||||
///PK玩法title
|
||||
@property (nonatomic, strong) UILabel *pkPlayModeLabel;
|
||||
///PK玩法
|
||||
@property (nonatomic, strong) UITextField *pkPlayModeTextField;
|
||||
///发起挑战按钮
|
||||
@property (nonatomic, strong) UIButton *doneButton;
|
||||
///选择房间的内容
|
||||
@property (nonatomic, strong) UIView *selectRoomContentView;
|
||||
///选中的房间头像
|
||||
@property (nonatomic, strong) NetImageView *avatarImageView;
|
||||
///房间标题
|
||||
@property (nonatomic, strong) UILabel *roomTitleLabel;
|
||||
//平台ID
|
||||
@property (nonatomic, strong) UILabel *idLabel;
|
||||
///取消选择房间
|
||||
@property (nonatomic, strong) UIButton *cancelButon;
|
||||
///选中的PK房间
|
||||
@property (nonatomic, strong) AnchorPKInfoModel *selectRoomInfo;
|
||||
///PK的时长
|
||||
@property (nonatomic, assign) NSInteger pkDuration;
|
||||
///选择PK房间
|
||||
@property (nonatomic, strong) XPAnchorPKSelectRoomView *selectView;
|
||||
///房间信息
|
||||
@property (nonatomic,strong) NSString *roomUid;
|
||||
@end
|
||||
|
||||
@implementation XPAnchorPKViewController
|
||||
|
||||
- (instancetype)initWithRoomUid:(NSString *)roomUid {
|
||||
if (self = [super init]) {
|
||||
self.roomUid = roomUid;
|
||||
self.modalPresentationStyle = UIModalPresentationOverFullScreen;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (XPAnchorPKPresenter *)createPresenter {
|
||||
return [[XPAnchorPKPresenter alloc] init];;
|
||||
}
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
[self initSubViews];
|
||||
[self initSubViewConstraints];
|
||||
self.pkDuration = 10;
|
||||
}
|
||||
|
||||
- (void)viewWillAppear:(BOOL)animated {
|
||||
[super viewWillAppear:animated];
|
||||
[IQKeyboardManager sharedManager].enable = YES;
|
||||
}
|
||||
|
||||
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
|
||||
[self.view endEditing:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.view.backgroundColor = [UIColor clearColor];
|
||||
[self.view addSubview:self.topView];
|
||||
[self.view addSubview:self.contentView];
|
||||
|
||||
[self.contentView addSubview:self.titleLabel];
|
||||
[self.contentView addSubview:self.helpButton];
|
||||
[self.contentView addSubview:self.userStackView];
|
||||
[self.contentView addSubview:self.timeStackView];
|
||||
[self.contentView addSubview:self.playStackView];
|
||||
[self.contentView addSubview:self.customTimeTextField];
|
||||
[self.contentView addSubview:self.doneButton];
|
||||
|
||||
[self.userStackView addArrangedSubview:self.selectPKLabel];
|
||||
[self.userStackView addArrangedSubview:self.selectPKButton];
|
||||
[self.userStackView addArrangedSubview:self.selectRoomContentView];
|
||||
|
||||
[self.timeStackView addArrangedSubview:self.selectPKTimeLabel];
|
||||
[self.timeStackView addArrangedSubview:self.chooseTimeStackView];
|
||||
|
||||
[self.chooseTimeStackView addArrangedSubview:self.tenMinuteButton];
|
||||
[self.chooseTimeStackView addArrangedSubview:self.twentyMinuteButton];
|
||||
[self.chooseTimeStackView addArrangedSubview:self.thirtyMinuteButton];
|
||||
|
||||
[self.playStackView addArrangedSubview:self.pkPlayModeLabel];
|
||||
[self.playStackView addArrangedSubview:self.pkPlayModeTextField];
|
||||
|
||||
[self.selectRoomContentView addSubview:self.avatarImageView];
|
||||
[self.selectRoomContentView addSubview:self.roomTitleLabel];
|
||||
[self.selectRoomContentView addSubview:self.idLabel];
|
||||
[self.selectRoomContentView addSubview:self.cancelButon];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
|
||||
[self.topView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.top.mas_equalTo(self.view);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_top);
|
||||
}];
|
||||
|
||||
[self.contentView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.bottom.mas_equalTo(self.view);
|
||||
make.height.mas_equalTo(kContentHeight);
|
||||
}];
|
||||
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.contentView);
|
||||
make.top.mas_equalTo(18);
|
||||
}];
|
||||
|
||||
[self.helpButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.mas_equalTo(-12);
|
||||
make.width.height.mas_equalTo(22);
|
||||
make.centerY.mas_equalTo(self.titleLabel);
|
||||
}];
|
||||
|
||||
[self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(32);
|
||||
make.left.mas_equalTo(self.contentView).offset(22);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20);
|
||||
}];
|
||||
|
||||
[self.selectPKLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(90);
|
||||
}];
|
||||
|
||||
[self.selectPKButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(22);
|
||||
}];
|
||||
|
||||
[self.selectRoomContentView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(KScreenWidth - 85 - 12 * 2 - 16);
|
||||
}];
|
||||
|
||||
[self.timeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(32);
|
||||
make.left.right.mas_equalTo(self.contentView).inset(22);
|
||||
make.top.mas_equalTo(self.userStackView.mas_bottom).offset(30);
|
||||
}];
|
||||
|
||||
[self.selectPKTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.selectPKLabel);
|
||||
}];
|
||||
|
||||
[self.customTimeTextField mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(32);
|
||||
make.width.mas_equalTo(170);
|
||||
make.top.mas_equalTo(self.timeStackView.mas_bottom).offset(16);
|
||||
make.left.mas_equalTo(self.tenMinuteButton);
|
||||
}];
|
||||
|
||||
[self.playStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.right.height.mas_equalTo(self.timeStackView);
|
||||
make.top.mas_equalTo(self.customTimeTextField.mas_bottom).offset(30);
|
||||
}];
|
||||
|
||||
[self.pkPlayModeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(self.selectPKLabel);
|
||||
}];
|
||||
|
||||
[self.doneButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(40);
|
||||
make.left.right.mas_equalTo(self.contentView).inset(40);
|
||||
make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-34 - kSafeAreaBottomHeight);
|
||||
}];
|
||||
|
||||
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.selectRoomContentView);
|
||||
make.left.mas_equalTo(self.selectRoomContentView);
|
||||
make.height.width.mas_equalTo(60);
|
||||
}];
|
||||
[self.roomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-3);
|
||||
make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(6);
|
||||
make.right.mas_lessThanOrEqualTo(self.cancelButon.mas_left);
|
||||
}];
|
||||
[self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.avatarImageView.mas_centerY).mas_offset(3);
|
||||
make.left.right.mas_equalTo(self.roomTitleLabel);
|
||||
}];
|
||||
|
||||
[self.cancelButon mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.avatarImageView);
|
||||
make.right.mas_equalTo(self.selectRoomContentView).offset(-12);
|
||||
make.height.width.mas_equalTo(22);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)updateDoneButtonState {
|
||||
if (self.selectRoomInfo && self.pkDuration >= 5 && self.pkDuration <= 180) {
|
||||
self.doneButton.enabled = YES;
|
||||
} else {
|
||||
self.doneButton.enabled = NO;
|
||||
}
|
||||
}
|
||||
#pragma mark - XPAcrossRoomProtocol
|
||||
- (void)beginAcrossRoomPKSuccess {
|
||||
[self showSuccessToast:@"pk已发起,请等待对方接受"];
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)beginAcrossRoomPKFail:(NSString *)message {
|
||||
if (message.length >0) {
|
||||
TTAlertConfig * config = [[TTAlertConfig alloc] init];
|
||||
config.actionStyle = TTAlertActionConfirmStyle;
|
||||
config.cancelButtonConfig.title = @"知道了";
|
||||
config.message = message;
|
||||
[TTPopup alertWithConfig:config confirmHandler:^{
|
||||
|
||||
} cancelHandler:^{
|
||||
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - XPAnchorPKSelectRoomViewDelegate
|
||||
///选择要PK的对象按钮点击
|
||||
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AnchorPKInfoModel *)pkRoomInfo {
|
||||
if (pkRoomInfo) {
|
||||
[self.userStackView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(60);
|
||||
}];
|
||||
self.selectRoomContentView.hidden = NO;
|
||||
self.selectPKButton.hidden= YES;
|
||||
self.avatarImageView.imageUrl = pkRoomInfo.avatar;
|
||||
self.roomTitleLabel.text = pkRoomInfo.title;
|
||||
self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", pkRoomInfo.erbanNo];
|
||||
self.selectRoomInfo = pkRoomInfo;
|
||||
[self updateDoneButtonState];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - UITextFieldDelegate
|
||||
- (void)textFieldDidChanged:(UITextField *)textField {
|
||||
if (textField == self.customTimeTextField) {
|
||||
self.tenMinuteButton.selected = YES;
|
||||
self.twentyMinuteButton.selected = YES;
|
||||
self.thirtyMinuteButton.selected = YES;
|
||||
NSString *countStr = [self.customTimeTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
|
||||
NSInteger count = [countStr integerValue];
|
||||
if (count > 180) {
|
||||
[self showErrorToast:@"PK时长最长为180分钟"];
|
||||
} else if(count < 5) {
|
||||
[self showErrorToast:@"PK时长最短为5分钟"];
|
||||
}
|
||||
self.pkDuration = textField.text.integerValue;
|
||||
[self updateDoneButtonState];
|
||||
} else if(textField == self.pkPlayModeTextField) {
|
||||
if (self.pkPlayModeTextField.text.length > 10) {
|
||||
self.pkPlayModeTextField.text = [self.pkPlayModeTextField.text substringToIndex:10];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string {
|
||||
if (textField == self.customTimeTextField) {
|
||||
NSString *regex =@"[0-9]*";
|
||||
NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex];
|
||||
if ([pred evaluateWithObject:string]) {
|
||||
return YES;
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)helpButtonAction:(UIButton *)sender {
|
||||
[self.customTimeTextField resignFirstResponder];
|
||||
[self.pkPlayModeTextField resignFirstResponder];
|
||||
XPAcrossRoomPKRuleView *view = [[XPAcrossRoomPKRuleView alloc] init];
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
|
||||
- (void)selectPKButtonAction:(UIButton *)sender {
|
||||
[self.customTimeTextField resignFirstResponder];
|
||||
[self.pkPlayModeTextField resignFirstResponder];
|
||||
self.selectView.roomUid = self.roomUid;
|
||||
CATransition *transition = [CATransition animation];
|
||||
transition.duration = 0.3f;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionPush;
|
||||
transition.subtype = kCATransitionFromRight;
|
||||
[self.selectView.layer addAnimation:transition forKey:nil];
|
||||
[self.contentView addSubview:self.selectView];
|
||||
}
|
||||
|
||||
- (void)chooseTimeButtonAction:(UIButton *)sender {
|
||||
[self.customTimeTextField resignFirstResponder];
|
||||
[self.pkPlayModeTextField resignFirstResponder];
|
||||
self.tenMinuteButton.selected = YES;
|
||||
self.twentyMinuteButton.selected = YES;
|
||||
self.thirtyMinuteButton.selected = YES;
|
||||
sender.selected = NO;
|
||||
self.pkDuration = sender.tag;
|
||||
self.customTimeTextField.text = nil;
|
||||
}
|
||||
|
||||
- (void)doneButtonAction:(UIButton *)sender {
|
||||
[self.customTimeTextField resignFirstResponder];
|
||||
[self.pkPlayModeTextField resignFirstResponder];
|
||||
NSString * pkDes = self.pkPlayModeTextField.text.length > 0 ? self.pkPlayModeTextField.text : @"";
|
||||
[self.presenter beginAnchorPK:self.roomUid duration:self.pkDuration acceptUid:self.selectRoomInfo.uid playDesc:pkDes];
|
||||
}
|
||||
|
||||
- (void)cancelButtonAction:(UIButton *)sender {
|
||||
self.selectRoomContentView.hidden = YES;
|
||||
self.selectPKButton.hidden = NO;
|
||||
self.selectRoomInfo = nil;
|
||||
[self updateDoneButtonState];
|
||||
self.avatarImageView.image = nil;
|
||||
self.roomTitleLabel.text = nil;
|
||||
self.idLabel.text = nil;
|
||||
[self.userStackView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.height.mas_equalTo(32);
|
||||
}];
|
||||
}
|
||||
|
||||
- (void)onKeyBoardResign:(UITapGestureRecognizer *)ges {
|
||||
[self.customTimeTextField resignFirstResponder];
|
||||
[self.pkPlayModeTextField resignFirstResponder];
|
||||
if (self.selectView.superview) {
|
||||
CATransition *transition = [CATransition animation];
|
||||
transition.duration = 0.3f;
|
||||
transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut];
|
||||
transition.type = kCATransitionPush;
|
||||
transition.subtype = kCATransitionFromLeft;
|
||||
[self.selectView.layer addAnimation:transition forKey:nil];
|
||||
[self.selectView removeFromSuperview];
|
||||
} else {
|
||||
[self dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UILabel *)titleLabel {
|
||||
if (!_titleLabel) {
|
||||
_titleLabel = [[UILabel alloc] init];
|
||||
_titleLabel.textColor = UIColor.whiteColor;
|
||||
_titleLabel.font = [UIFont boldSystemFontOfSize:18];
|
||||
_titleLabel.text = @"主播PK";
|
||||
}
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)helpButton {
|
||||
if (!_helpButton) {
|
||||
_helpButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_helpButton setImage:[UIImage imageNamed:@"room_across_pk_help"] forState:UIControlStateNormal];
|
||||
[_helpButton addTarget:self action:@selector(helpButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _helpButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)userStackView {
|
||||
if (!_userStackView) {
|
||||
_userStackView = [[UIStackView alloc] init];
|
||||
_userStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_userStackView.distribution = UIStackViewDistributionFill;
|
||||
_userStackView.alignment = UIStackViewAlignmentFill;
|
||||
_userStackView.spacing = 16;
|
||||
}
|
||||
return _userStackView;
|
||||
}
|
||||
- (UILabel *)selectPKLabel {
|
||||
if (!_selectPKLabel) {
|
||||
_selectPKLabel = [[UILabel alloc] init];
|
||||
_selectPKLabel.textColor = [UIColor whiteColor];
|
||||
_selectPKLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
_selectPKLabel.text = @"选择PK对象";
|
||||
[_selectPKLabel setContentCompressionResistancePriority:UILayoutPriorityRequired forAxis:UILayoutConstraintAxisHorizontal];
|
||||
}
|
||||
return _selectPKLabel;
|
||||
}
|
||||
- (UIButton *)selectPKButton {
|
||||
if (!_selectPKButton) {
|
||||
_selectPKButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_selectPKButton setImage:[UIImage imageNamed:@"room_across_pk_add_room"] forState:UIControlStateNormal];
|
||||
[_selectPKButton addTarget:self action:@selector(selectPKButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _selectPKButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)timeStackView {
|
||||
if (!_timeStackView) {
|
||||
_timeStackView = [[UIStackView alloc] init];
|
||||
_timeStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_timeStackView.distribution = UIStackViewDistributionFill;
|
||||
_timeStackView.alignment = UIStackViewAlignmentFill;
|
||||
_timeStackView.spacing = 16;
|
||||
}
|
||||
return _timeStackView;
|
||||
}
|
||||
- (UILabel *)selectPKTimeLabel {
|
||||
if (!_selectPKTimeLabel) {
|
||||
_selectPKTimeLabel = [[UILabel alloc] init];
|
||||
_selectPKTimeLabel.textColor =[UIColor whiteColor];
|
||||
_selectPKTimeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
_selectPKTimeLabel.text = @"选择PK时长";
|
||||
}
|
||||
return _selectPKTimeLabel;
|
||||
}
|
||||
|
||||
- (UIStackView *)chooseTimeStackView {
|
||||
if (!_chooseTimeStackView) {
|
||||
_chooseTimeStackView = [[UIStackView alloc] init];
|
||||
_chooseTimeStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_chooseTimeStackView.distribution = UIStackViewDistributionFillEqually;
|
||||
_chooseTimeStackView.alignment = UIStackViewAlignmentFill;
|
||||
_chooseTimeStackView.spacing = 5;
|
||||
}
|
||||
return _chooseTimeStackView;
|
||||
}
|
||||
|
||||
- (UIButton *)tenMinuteButton {
|
||||
if (!_tenMinuteButton) {
|
||||
_tenMinuteButton = [[UIButton alloc] init];
|
||||
[_tenMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_tenMinuteButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x4C4C6A)] forState:UIControlStateSelected];
|
||||
[_tenMinuteButton setTitle:@"10分钟" forState:UIControlStateNormal];
|
||||
_tenMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
[_tenMinuteButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal];
|
||||
[_tenMinuteButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateSelected];
|
||||
_tenMinuteButton.tag = 10;
|
||||
[_tenMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_tenMinuteButton.selected = NO;
|
||||
_tenMinuteButton.layer.masksToBounds = YES;
|
||||
_tenMinuteButton.layer.cornerRadius = 32 / 2;
|
||||
}
|
||||
return _tenMinuteButton;
|
||||
}
|
||||
|
||||
- (UIButton *)twentyMinuteButton {
|
||||
if (!_twentyMinuteButton) {
|
||||
_twentyMinuteButton = [[UIButton alloc] init];
|
||||
[_twentyMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_twentyMinuteButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x4C4C6A)] forState:UIControlStateSelected];
|
||||
[_twentyMinuteButton setTitle:@"20分钟" forState:UIControlStateNormal];
|
||||
_twentyMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
[_twentyMinuteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_twentyMinuteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
|
||||
_twentyMinuteButton.tag = 20;
|
||||
[_twentyMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_twentyMinuteButton.selected = YES;
|
||||
_twentyMinuteButton.layer.masksToBounds = YES;
|
||||
_twentyMinuteButton.layer.cornerRadius = 32 / 2;
|
||||
}
|
||||
return _twentyMinuteButton;
|
||||
}
|
||||
|
||||
- (UIButton *)thirtyMinuteButton {
|
||||
if (!_thirtyMinuteButton) {
|
||||
_thirtyMinuteButton = [[UIButton alloc] init];
|
||||
[_thirtyMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_thirtyMinuteButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x4C4C6A)] forState:UIControlStateSelected];
|
||||
[_thirtyMinuteButton setTitle:@"30分钟" forState:UIControlStateNormal];
|
||||
_thirtyMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium];
|
||||
[_thirtyMinuteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_thirtyMinuteButton setTitleColor:[UIColor whiteColor] forState:UIControlStateSelected];
|
||||
_thirtyMinuteButton.tag = 30;
|
||||
_thirtyMinuteButton.layer.masksToBounds = YES;
|
||||
_thirtyMinuteButton.layer.cornerRadius = 32 / 2;
|
||||
[_thirtyMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_thirtyMinuteButton.selected = YES;
|
||||
}
|
||||
return _thirtyMinuteButton;
|
||||
}
|
||||
- (UITextField *)customTimeTextField {
|
||||
if (!_customTimeTextField) {
|
||||
_customTimeTextField = [[UITextField alloc] init];
|
||||
_customTimeTextField.layer.cornerRadius = 15;
|
||||
_customTimeTextField.layer.masksToBounds = YES;
|
||||
_customTimeTextField.backgroundColor = UIColorFromRGB(0x4C4C6A);
|
||||
_customTimeTextField.textColor = [UIColor whiteColor];
|
||||
_customTimeTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 19, 0)];
|
||||
_customTimeTextField.leftViewMode = UITextFieldViewModeAlways;
|
||||
_customTimeTextField.delegate = self;
|
||||
_customTimeTextField.keyboardType = UIKeyboardTypeNumberPad;
|
||||
_customTimeTextField.tintColor = [UIColor whiteColor];
|
||||
_customTimeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"自定义(5-180)分钟" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0xC6C6E9)}];
|
||||
[_customTimeTextField addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||
|
||||
}
|
||||
return _customTimeTextField;
|
||||
}
|
||||
- (UIStackView *)playStackView {
|
||||
if (!_playStackView) {
|
||||
_playStackView = [[UIStackView alloc] init];
|
||||
_playStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_playStackView.distribution = UIStackViewDistributionFill;
|
||||
_playStackView.alignment = UIStackViewAlignmentFill;
|
||||
_playStackView.spacing = 16;
|
||||
}
|
||||
return _playStackView;
|
||||
}
|
||||
|
||||
- (UILabel *)pkPlayModeLabel {
|
||||
if (!_pkPlayModeLabel) {
|
||||
_pkPlayModeLabel = [[UILabel alloc] init];
|
||||
_pkPlayModeLabel.textColor = [UIColor whiteColor];
|
||||
_pkPlayModeLabel.textAlignment = NSTextAlignmentRight;
|
||||
_pkPlayModeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
|
||||
_pkPlayModeLabel.text = @"PK玩法";
|
||||
}
|
||||
return _pkPlayModeLabel;
|
||||
}
|
||||
|
||||
- (UITextField *)pkPlayModeTextField {
|
||||
if (!_pkPlayModeTextField) {
|
||||
_pkPlayModeTextField = [[UITextField alloc] init];
|
||||
_pkPlayModeTextField.layer.cornerRadius = 15;
|
||||
_pkPlayModeTextField.layer.masksToBounds = YES;
|
||||
_pkPlayModeTextField.backgroundColor = UIColorFromRGB(0x4C4C6A);
|
||||
_pkPlayModeTextField.textColor = [UIColor whiteColor];
|
||||
_pkPlayModeTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 19, 0)];
|
||||
_pkPlayModeTextField.leftViewMode = UITextFieldViewModeAlways;
|
||||
_pkPlayModeTextField.delegate = self;
|
||||
_pkPlayModeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"选填,10个字以内" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0x43BDFF)}];
|
||||
[_pkPlayModeTextField addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
|
||||
}
|
||||
return _pkPlayModeTextField;
|
||||
}
|
||||
|
||||
- (UIButton *)doneButton {
|
||||
if (!_doneButton) {
|
||||
_doneButton = [[UIButton alloc] init];
|
||||
[_doneButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
|
||||
[_doneButton setBackgroundImage:[UIImage imageWithColor:UIColorFromRGB(0x4C4C6A)] forState:UIControlStateDisabled];
|
||||
[_doneButton setTitle:@"发起挑战" forState:UIControlStateNormal];
|
||||
_doneButton.layer.masksToBounds = YES;
|
||||
_doneButton.layer.cornerRadius = 20;
|
||||
_doneButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
|
||||
[_doneButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
|
||||
[_doneButton setTitleColor:[UIColor whiteColor] forState:UIControlStateDisabled];
|
||||
[_doneButton addTarget:self action:@selector(doneButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_doneButton.enabled = NO;
|
||||
}
|
||||
return _doneButton;
|
||||
}
|
||||
|
||||
- (UIView *)selectRoomContentView {
|
||||
if (!_selectRoomContentView) {
|
||||
_selectRoomContentView = [[UIView alloc] init];
|
||||
_selectRoomContentView.hidden = YES;
|
||||
}
|
||||
return _selectRoomContentView;
|
||||
}
|
||||
|
||||
- (NetImageView *)avatarImageView {
|
||||
if (!_avatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
config.imageType = ImageTypeUserIcon;
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_avatarImageView.layer.masksToBounds = YES;
|
||||
_avatarImageView.layer.cornerRadius = 60 / 2;
|
||||
_avatarImageView.layer.borderColor = [UIColor whiteColor].CGColor;
|
||||
_avatarImageView.layer.borderWidth = 1;
|
||||
}
|
||||
return _avatarImageView;
|
||||
}
|
||||
|
||||
- (UILabel *)roomTitleLabel {
|
||||
if (!_roomTitleLabel) {
|
||||
_roomTitleLabel = [[UILabel alloc] init];
|
||||
_roomTitleLabel.textColor = [UIColor whiteColor];
|
||||
_roomTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _roomTitleLabel;
|
||||
}
|
||||
|
||||
- (UILabel *)idLabel {
|
||||
if (!_idLabel) {
|
||||
_idLabel = [[UILabel alloc] init];
|
||||
_idLabel.textColor = [UIColor whiteColor];
|
||||
_idLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _idLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)cancelButon {
|
||||
if (!_cancelButon) {
|
||||
_cancelButon = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_cancelButon setImage:[UIImage imageNamed:@"room_across_delete_pk_room"] forState:UIControlStateNormal];
|
||||
[_cancelButon addTarget:self action:@selector(cancelButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _cancelButon;
|
||||
}
|
||||
|
||||
- (UIView *)contentView {
|
||||
if (!_contentView) {
|
||||
_contentView = [[UIView alloc] init];
|
||||
_contentView.backgroundColor = UIColorFromRGB(0x2A2A39);
|
||||
CAShapeLayer * layer = [CAShapeLayer layer];
|
||||
layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth,kContentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)].CGPath;
|
||||
_contentView.layer.mask = layer;
|
||||
}
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (UIView *)topView {
|
||||
if (!_topView) {
|
||||
_topView = [[UIView alloc] init];
|
||||
_topView.backgroundColor = UIColor.blackColor;
|
||||
_topView.alpha = 0.3;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onKeyBoardResign:)];
|
||||
[_topView addGestureRecognizer:tap];
|
||||
}
|
||||
return _topView;
|
||||
}
|
||||
|
||||
- (XPAnchorPKSelectRoomView *)selectView {
|
||||
if (!_selectView) {
|
||||
_selectView = [[XPAnchorPKSelectRoomView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kContentHeight)];
|
||||
_selectView.delegate = self;
|
||||
}
|
||||
return _selectView;
|
||||
}
|
||||
|
||||
@end
|
@@ -38,6 +38,10 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) {
|
||||
RoomMoreMenuType_Room_Across_PK_Open = 13,
|
||||
///关闭跨房pk
|
||||
RoomMoreMenuType_Room_Across_PK_Close = 14,
|
||||
///开启主播PK
|
||||
RoomMoreMenuType_Room_Anchor_PK_Open = 15,
|
||||
///关闭主播Pk
|
||||
RoomMoreMenuType_Room_Anchor_PK_Close = 16,
|
||||
};
|
||||
|
||||
@interface XPRoomMoreItemModel : NSObject
|
||||
|
@@ -47,6 +47,12 @@
|
||||
acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Across_PK_Close : RoomMoreMenuType_Room_Across_PK_Open;
|
||||
acrossRoomPK.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * anchorRoomPK = [[XPRoomMoreItemModel alloc] init];
|
||||
anchorRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"主播PK中" : @"主播PK";
|
||||
anchorRoomPK.imageName = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"room_more_menu_cross_pk_close" : @"room_more_menu_cross_pk_open";
|
||||
anchorRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Anchor_PK_Close : RoomMoreMenuType_Room_Anchor_PK_Open;
|
||||
anchorRoomPK.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor];
|
||||
|
||||
XPRoomMoreItemModel * messageScreen = [[XPRoomMoreItemModel alloc] init];
|
||||
messageScreen.title = roomInfo.isCloseScreen ? @"开启公屏" : @"关闭公屏";
|
||||
messageScreen.imageName = roomInfo.isCloseScreen ? @"room_more_menu_message_open" : @"room_more_menu_message_close";
|
||||
@@ -92,7 +98,9 @@
|
||||
if (isCreator && roomInfo.isPermitRoom == PermitRoomType_Licnese && roomInfo.type != RoomType_MiniGame) {
|
||||
[array addObject:acrossRoomPK];
|
||||
}
|
||||
|
||||
if (isCreator && roomInfo.type == RoomType_Anchor) {
|
||||
[array addObject:anchorRoomPK];
|
||||
}
|
||||
if (isCreator || isManager) {
|
||||
if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor && roomInfo.type != RoomType_MiniGame) {
|
||||
[array addObject:dating];
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#import "XPRoomMoreMenuCollectionViewCell.h"
|
||||
#import "XPRoomInviteFansView.h"
|
||||
#import "XPAcrossRoomPKViewController.h"
|
||||
#import "XPAnchorPKViewController.h"
|
||||
///P
|
||||
#import "XPMoreMenuPresenter.h"
|
||||
#import "XPMoreMenuProtocol.h"
|
||||
@@ -288,6 +289,21 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey;
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Anchor_PK_Open:
|
||||
{
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
XPAnchorPKViewController * acrossRoomPKVC = [[XPAnchorPKViewController alloc] initWithRoomUid:roomUid];
|
||||
[self.currentNav presentViewController:acrossRoomPKVC animated:YES completion:nil];
|
||||
}
|
||||
break;
|
||||
case RoomMoreMenuType_Room_Anchor_PK_Close:
|
||||
{
|
||||
[self showErrorToast:@"主播正在PK中!"];
|
||||
[self dismissViewControllerAnimated:NO completion:nil];
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user