个播跨房PK面板优化

This commit is contained in:
chenguilong
2022-04-12 18:16:18 +08:00
parent 1bb71681af
commit a84e844df5
42 changed files with 889 additions and 315 deletions

View File

@@ -126,7 +126,6 @@
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 */; };
@@ -146,11 +145,11 @@
9B2EA7C02804037700ED17BF /* AnchorPKStageView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7BF2804037700ED17BF /* AnchorPKStageView.m */; };
9B2EA7C32804052E00ED17BF /* AnchorPKMicroView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7C22804052E00ED17BF /* AnchorPKMicroView.m */; };
9B2EA7C628041EFC00ED17BF /* XPAnchorPkPanelView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7C528041EFC00ED17BF /* XPAnchorPkPanelView.m */; };
9B2EA7C9280423E000ED17BF /* AnchorPKPanelModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7C8280423E000ED17BF /* AnchorPKPanelModel.m */; };
9B2EA7CC2804245500ED17BF /* XPAnchorPKPanelUserView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B2EA7CB2804245500ED17BF /* XPAnchorPKPanelUserView.m */; };
9B33E3CB27D85379003B0E62 /* UploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3C927D85379003B0E62 /* UploadFile.m */; };
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */; };
9B33E3D427D8A1A4003B0E62 /* XPSkillCardPlayerManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */; };
9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */; };
9B4D148127E485EB000AA0C1 /* XPRoomTrumpetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */; };
9B5BF8A827E1BED1005DD346 /* Api+RoomTrumpet.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B5BF8A727E1BED1005DD346 /* Api+RoomTrumpet.m */; };
9B6B3AAB278C2EA7005551EC /* XPRoomNobleLevelUpView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B6B3AAA278C2EA7005551EC /* XPRoomNobleLevelUpView.m */; };
@@ -865,8 +864,6 @@
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>"; };
@@ -906,8 +903,6 @@
9B2EA7C22804052E00ED17BF /* AnchorPKMicroView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorPKMicroView.m; sourceTree = "<group>"; };
9B2EA7C428041EFC00ED17BF /* XPAnchorPkPanelView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPkPanelView.h; sourceTree = "<group>"; };
9B2EA7C528041EFC00ED17BF /* XPAnchorPkPanelView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPkPanelView.m; sourceTree = "<group>"; };
9B2EA7C7280423E000ED17BF /* AnchorPKPanelModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AnchorPKPanelModel.h; sourceTree = "<group>"; };
9B2EA7C8280423E000ED17BF /* AnchorPKPanelModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AnchorPKPanelModel.m; sourceTree = "<group>"; };
9B2EA7CA2804245500ED17BF /* XPAnchorPKPanelUserView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKPanelUserView.h; sourceTree = "<group>"; };
9B2EA7CB2804245500ED17BF /* XPAnchorPKPanelUserView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKPanelUserView.m; sourceTree = "<group>"; };
9B33E3C927D85379003B0E62 /* UploadFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UploadFile.m; sourceTree = "<group>"; };
@@ -916,6 +911,8 @@
9B33E3CD27D8540C003B0E62 /* XPVoiceCardViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = XPVoiceCardViewController.m; sourceTree = "<group>"; };
9B33E3D227D8A1A4003B0E62 /* XPSkillCardPlayerManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPSkillCardPlayerManager.h; sourceTree = "<group>"; };
9B33E3D327D8A1A4003B0E62 /* XPSkillCardPlayerManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPSkillCardPlayerManager.m; sourceTree = "<group>"; };
9B3A1DF2280571000058E2DD /* XPAnchorPKInviteView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAnchorPKInviteView.h; sourceTree = "<group>"; };
9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAnchorPKInviteView.m; sourceTree = "<group>"; };
9B4D147F27E485EB000AA0C1 /* XPRoomTrumpetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomTrumpetView.h; sourceTree = "<group>"; };
9B4D148027E485EB000AA0C1 /* XPRoomTrumpetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomTrumpetView.m; sourceTree = "<group>"; };
9B5BF8A627E1BED1005DD346 /* Api+RoomTrumpet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+RoomTrumpet.h"; sourceTree = "<group>"; };
@@ -2609,10 +2606,6 @@
9B1B72A328003153003FACE9 /* Model */ = {
isa = PBXGroup;
children = (
9B1B72B02800343F003FACE9 /* AnchorPKInfoModel.h */,
9B1B72B12800343F003FACE9 /* AnchorPKInfoModel.m */,
9B2EA7C7280423E000ED17BF /* AnchorPKPanelModel.h */,
9B2EA7C8280423E000ED17BF /* AnchorPKPanelModel.m */,
);
path = Model;
sourceTree = "<group>";
@@ -2648,6 +2641,8 @@
9B2EA7C528041EFC00ED17BF /* XPAnchorPkPanelView.m */,
9B2EA7CA2804245500ED17BF /* XPAnchorPKPanelUserView.h */,
9B2EA7CB2804245500ED17BF /* XPAnchorPKPanelUserView.m */,
9B3A1DF2280571000058E2DD /* XPAnchorPKInviteView.h */,
9B3A1DF3280571000058E2DD /* XPAnchorPKInviteView.m */,
);
path = SubViews;
sourceTree = "<group>";
@@ -5419,7 +5414,6 @@
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 */,
@@ -5477,7 +5471,6 @@
E8C1CD7327D8A16500376F83 /* XPRoomFaceTool.m in Sources */,
E8A03DE22762FA000098D9EA /* XPCandyTreeMoreView.m in Sources */,
E8B825CA26EA1231009E8E9F /* LoginVerifCodeViewController.m in Sources */,
9B2EA7C9280423E000ED17BF /* AnchorPKPanelModel.m in Sources */,
189DD76226E60DDC00AB55B1 /* Api+Login.m in Sources */,
E8412FA62779BED1006E1101 /* XPRoomSettingTableViewCell.m in Sources */,
9B7D80502753AA9D003DAC0C /* UITableView+NIMScrollToBottom.m in Sources */,
@@ -5854,6 +5847,7 @@
9B7D8857279C099C00785A25 /* XPSkillCardListPropCell.m in Sources */,
E83DB481274649FB00D8CBD1 /* XPGiftBannerUserInfoModel.m in Sources */,
9B33E3CE27D8540C003B0E62 /* XPVoiceCardViewController.m in Sources */,
9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */,
9B2489BC27C4C056006CFB85 /* XPMineVisitorEmptyTableViewCell.m in Sources */,
E878893F273A54F500BF1D57 /* XPGiftPresenter.m in Sources */,
E8A03DF62763367F0098D9EA /* XPCandyTreeEmptyableViewCell.m in Sources */,

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 99 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 B

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 620 B

View File

@@ -256,10 +256,12 @@ typedef NS_ENUM(NSUInteger, CustomMessageSubAcrossRoomPK) {
Custom_Message_Sub_AnchorPK_Accept = 839,
///个播PK面板消息
Custom_Message_Sub_AnchorPK_Panel = 8310,
///个播PK结束通知
///个播PK结束通知(收到后进入惩罚阶段)
Custom_Message_Sub_AnchorPK_End = 8311,
///个播PK结束飘屏
Custom_Message_Sub_AnchorPK_Result = 8312,
///个播PK完成
Custom_Message_Sub_AnchorPK_Finish = 8313,
};
///first = CustomMessageType_Noble_VIP

View File

@@ -154,6 +154,11 @@ NS_ASSUME_NONNULL_BEGIN
/// @param teamUid 房间uid
+ (void)requestFansTeamTask:(HttpRequestHelperCompletion)completion teamUid:(NSString *)teamUid;
/// 结束个播房PK
/// @param completion 完成
/// @param roundId PK场次id
+ (void)requestEndAnchorRoomPk:(HttpRequestHelperCompletion)completion roundId:(NSString *)roundId;
@end
NS_ASSUME_NONNULL_END

View File

@@ -174,4 +174,11 @@
[self makeRequest:@"anchorFansTeam/getFansTaskInfo" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, teamUid, nil];
}
/// PK
/// @param completion
/// @param roundId PKid
+ (void)requestEndAnchorRoomPk:(HttpRequestHelperCompletion)completion roundId:(NSString *)roundId {
[self makeRequest:@"crossroompkround/endSingleRoomPk" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, roundId, nil];
}
@end

View File

@@ -22,6 +22,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString * erbanNo;
///是否选中
@property (nonatomic, assign) BOOL hadSelected;
///是否PK中
@property (nonatomic, assign) BOOL crossPking;
@end
NS_ASSUME_NONNULL_END

View File

@@ -8,6 +8,11 @@
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
typedef NS_ENUM(NSUInteger, AcrossRoomPkType) {
AcrossRoomPkTypeLicnese = 1, ///牌照房PK
AcrossRoomPkTypeAnchor, ///个播PK
};
@class AcrossRoomPkRankModel;
@interface AcrossRoomPKPanelModel : NSObject
///当前时间
@@ -48,6 +53,10 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString * winUid;
///是否异常结束
@property (nonatomic, assign) BOOL isForce;
///PK类型 1牌照房 2个播房
@property (nonatomic, assign) AcrossRoomPkType pkType;
///场次id
@property (nonatomic, assign) NSInteger roundId;
@end
@interface AcrossRoomPkRankModel : NSObject

View File

@@ -1,31 +0,0 @@
//
// 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;
///是否PK中
@property (nonatomic, assign) BOOL crossPking;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,12 +0,0 @@
//
// AnchorPKInfoModel.m
// xplan-ios
//
// Created by GreenLand on 2022/4/8.
//
#import "AnchorPKInfoModel.h"
@implementation AnchorPKInfoModel
@end

View File

@@ -1,69 +0,0 @@
//
// AnchorPKPanelModel.h
// xplan-ios
//
// Created by GreenLand on 2022/4/11.
//
#import <Foundation/Foundation.h>
#import "XPEnum.h"
NS_ASSUME_NONNULL_BEGIN
@class AnchorPkRankModel;
@interface AnchorPKPanelModel : NSObject
///当前时间
@property (nonatomic, assign) long now;
///对方流水
@property (nonatomic, assign) long long aAmount;
///对方头像
@property (nonatomic, copy) NSString *aAvatar;
/// 所有流水
@property (nonatomic, assign) long long allAmount;
///对方进度条比例
@property (nonatomic, assign) float aPercent;
///对方魅力榜
@property (nonatomic, strong) NSArray<AnchorPkRankModel *> *arRank;
///对方贡献榜
@property (nonatomic, strong) NSArray<AnchorPkRankModel *> *asRank;
///对方标题
@property (nonatomic, copy) NSString *aTitle;
///对方UID
@property (nonatomic, copy) NSString *aUid;
///我方流水
@property (nonatomic, assign) long long cAmount;
///我方头像
@property (nonatomic, copy) NSString *cAvatar;
///我方进度条比例
@property (nonatomic, assign) float cPercent;
///我方魅力榜
@property (nonatomic, strong) NSArray<AnchorPkRankModel *> *crRank;
///我方贡献榜
@property (nonatomic, strong) NSArray<AnchorPkRankModel *> *csRank;
///我方标题
@property (nonatomic, copy) NSString *cTitle;
///我方UID
@property (nonatomic, copy) NSString * cUid;
///结束时间戳
@property (nonatomic, assign) long long endTime;
/// 赢家uid
@property (nonatomic, copy) NSString * winUid;
///是否异常结束
@property (nonatomic, assign) BOOL isForce;
@end
@interface AnchorPkRankModel : NSObject
///金币
@property (nonatomic, copy) NSString *amount;
///性别
@property (nonatomic, assign) GenderType gender;
///昵称
@property (nonatomic, copy) NSString *nick;
///头像
@property (nonatomic, copy) NSString *avatar;
///Uid
@property (nonatomic, copy) NSString * uid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,28 +0,0 @@
//
// AnchorPKPanelModel.m
// xplan-ios
//
// Created by GreenLand on 2022/4/11.
//
#import "AnchorPKPanelModel.h"
@implementation AnchorPKPanelModel
///
///
+ (NSDictionary *)objectClassInArray {
return @{@"arRank" : [AnchorPkRankModel class],
@"asRank" : [AnchorPkRankModel class],
@"crRank" : [AnchorPkRankModel class],
@"csRank" : [AnchorPkRankModel class]
};
}
@end
@implementation AnchorPkRankModel
@end

View File

@@ -9,15 +9,15 @@
NS_ASSUME_NONNULL_BEGIN
@class AnchorPKInfoModel, XPAnchorPKTableViewCell;
@class AcrossRoomPKInfoModel, XPAnchorPKTableViewCell;
@protocol XPAnchorPKTableViewCellDelegate <NSObject>
///点击了选择的按钮
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AnchorPKInfoModel *)roomInfo;
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AcrossRoomPKInfoModel *)roomInfo;
@end
@interface XPAnchorPKTableViewCell : UITableViewCell
@property (nonatomic,strong) AnchorPKInfoModel *roomPKInfo;
@property (nonatomic,strong) AcrossRoomPKInfoModel *roomPKInfo;
///代理
@property (nonatomic,weak) id<XPAnchorPKTableViewCellDelegate> delegate;

View File

@@ -13,7 +13,7 @@
#import "NetImageView.h"
#import "UIImage+Utils.h"
///Model
#import "AnchorPKInfoModel.h"
#import "AcrossRoomPKInfoModel.h"
@interface XPAnchorPKTableViewCell()
@@ -84,7 +84,7 @@
}
#pragma mark - Getters And Setters
- (void)setRoomPKInfo:(AnchorPKInfoModel *)roomPKInfo {
- (void)setRoomPKInfo:(AcrossRoomPKInfoModel *)roomPKInfo {
_roomPKInfo = roomPKInfo;
self.avatarImageView.imageUrl = _roomPKInfo.avatar;
self.nameLabel.text = _roomPKInfo.title;

View File

@@ -0,0 +1,21 @@
//
// XPAnchorPKInviteView.h
// xplan-ios
//
// Created by GreenLand on 2022/4/12.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface XPAnchorPKInviteView : UIView
///房主的uid
@property (nonatomic,copy) NSString *roomUid;
///数据源
@property (nonatomic,copy) NSDictionary *dataDic;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,353 @@
//
// XPAnchorPKInviteView.m
// xplan-ios
//
// Created by GreenLand on 2022/4/12.
//
#import "XPAnchorPKInviteView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "XPMacro.h"
#import "UIImage+Utils.h"
#import "Api+Room.h"
#import "XCHudTool.h"
@interface XPAnchorPKInviteSubView : UIView
///
@property (nonatomic,strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UILabel *contentLabel;
@end
@implementation XPAnchorPKInviteSubView
- (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.titleLabel];
[self addSubview:self.contentLabel];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(17);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(55);
make.left.centerY.mas_equalTo(self);
}];
[self.contentLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.titleLabel.mas_right).offset(15);
make.centerY.mas_equalTo(self);
make.right.mas_lessThanOrEqualTo(self).offset(-5);
}];
}
#pragma mark - Getters And Setters
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [ThemeColor mainTextColor];
_titleLabel.font = [UIFont systemFontOfSize:14];
_titleLabel.text = @"PK时长";
_titleLabel.textAlignment = NSTextAlignmentRight;
}
return _titleLabel;
}
- (UILabel *)contentLabel {
if (!_contentLabel) {
_contentLabel = [[UILabel alloc] init];
_contentLabel.textColor = [ThemeColor mainTextColor];
_contentLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
}
return _contentLabel;
}
@end
@interface XPAnchorPKInviteView ()
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic,strong) UIStackView *stackView;
///
@property (nonatomic,strong) XPAnchorPKInviteSubView *inviteView;
///PK
@property (nonatomic,strong) XPAnchorPKInviteSubView *timeView;
///PK
@property (nonatomic,strong) XPAnchorPKInviteSubView *descView;
///
@property (nonatomic,strong) UIStackView *operaStackView;
///
@property (nonatomic, strong) UIButton *rejectButton;
///
@property (nonatomic, strong) UIButton *acceptButton;
///
@property (nonatomic, strong) UIImageView *backImageView;
///
@property (nonatomic, strong) UIButton *countDownButton;
//
@property (strong, nonatomic) dispatch_source_t inviteTimer;
@end
@implementation XPAnchorPKInviteView
- (void)dealloc {
if (self.inviteTimer != nil) {
dispatch_source_cancel(self.inviteTimer);
self.inviteTimer = nil;
}
}
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
- (void)initSubViews {
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.titleLabel];
[self.backImageView addSubview:self.stackView];
[self.backImageView addSubview:self.operaStackView];
[self.backImageView addSubview:self.countDownButton];
[self.stackView addArrangedSubview:self.inviteView];
[self.stackView addArrangedSubview:self.timeView];
[self.stackView addArrangedSubview:self.descView];
[self.operaStackView addArrangedSubview:self.rejectButton];
[self.operaStackView addArrangedSubview:self.acceptButton];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(300);
make.height.mas_equalTo(306);
make.bottom.mas_equalTo(self.backImageView.mas_bottom);
}];
[self.backImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(self);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.backImageView).mas_offset(64);
}];
[self.countDownButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.top.mas_equalTo(0);
make.width.mas_equalTo(36);
make.height.mas_equalTo(26);
}];
[self.stackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.backImageView).offset(26);
make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(32);
make.right.mas_equalTo(self.backImageView);
}];
[self.operaStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self.backImageView).inset(20);
make.height.mas_equalTo(40);
make.top.mas_equalTo(self.stackView.mas_bottom).offset(32);
}];
}
#pragma mark - Event Response
- (void)acceptButtonAction:(UIButton *)sender {
NSString *roundId = self.dataDic[@"roundId"];
[Api handleAcrossRoomPKInvite:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
dispatch_source_cancel(self.inviteTimer);
self.inviteTimer = nil;
[self removeFromSuperview];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:self.roomUid roundId:roundId isAccept:@"1"];
}
- (void)rejectButtonAction:(UIButton *)sender {
NSString *roundId = self.dataDic[@"roundId"];
[Api handleAcrossRoomPKInvite:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
dispatch_source_cancel(self.inviteTimer);
self.inviteTimer = nil;
[self removeFromSuperview];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:self.roomUid roundId:roundId isAccept:@"0"];
}
#pragma mark - getter
- (void)setDataDic:(NSDictionary *)dataDic {
_dataDic = dataDic;
if (_dataDic.allKeys.count > 0) {
self.inviteView.contentLabel.text = _dataDic[@"inviteRoomTitle"];
self.timeView.contentLabel.text = [NSString stringWithFormat:@"%@分钟", _dataDic[@"pkDuration"]];
NSString *desc = _dataDic[@"pkDesc"];
if (desc.length > 0) {
self.descView.hidden = NO;
self.descView.contentLabel.text = desc;
} else {
self.descView.hidden = YES;
}
if (_inviteTimer != nil) {
dispatch_source_cancel(_inviteTimer);
}
__block NSInteger time = 10; //
dispatch_queue_t queue = dispatch_get_global_queue(0, 0);
_inviteTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue);
@kWeakify(self);
dispatch_source_set_timer(_inviteTimer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //
dispatch_source_set_event_handler(_inviteTimer, ^{
if(time <= 0){ //
dispatch_source_cancel(self.inviteTimer);
self.inviteTimer = nil;
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
[self removeFromSuperview];
});
}else{
dispatch_async(dispatch_get_main_queue(), ^{
@kStrongify(self);
[self.countDownButton setTitle:[NSString stringWithFormat:@"%02ld", time] forState:UIControlStateNormal];
});
time--;
}
});
dispatch_resume(_inviteTimer);
}
}
- (UIImageView *)backImageView {
if (!_backImageView) {
_backImageView = [[UIImageView alloc] init];
_backImageView.userInteractionEnabled = YES;
_backImageView.image = [UIImage imageNamed:@"anchorPK_invite_bg"];
}
return _backImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:15];
_titleLabel.text = @"PK邀请";
}
return _titleLabel;
}
- (UIStackView *)stackView {
if (!_stackView) {
_stackView = [[UIStackView alloc] init];
_stackView.axis = UILayoutConstraintAxisVertical;
_stackView.distribution = UIStackViewDistributionFill;
_stackView.alignment = UIStackViewAlignmentFill;
_stackView.spacing = 16;
}
return _stackView;
}
- (XPAnchorPKInviteSubView *)inviteView {
if (!_inviteView) {
_inviteView = [[XPAnchorPKInviteSubView alloc] init];
_inviteView.titleLabel.text = @"邀请方:";
}
return _inviteView;
}
- (XPAnchorPKInviteSubView *)timeView {
if (!_timeView) {
_timeView = [[XPAnchorPKInviteSubView alloc] init];
_timeView.titleLabel.text = @"PK时长:";
}
return _timeView;
}
- (XPAnchorPKInviteSubView *)descView {
if (!_descView) {
_descView = [[XPAnchorPKInviteSubView alloc] init];
_descView.titleLabel.text = @"PK玩法:";
}
return _descView;
}
- (UIButton *)countDownButton {
if (!_countDownButton) {
_countDownButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_countDownButton setTitleColor:UIColorFromRGB(0xFFFFFF) forState:UIControlStateNormal];
_countDownButton.titleLabel.font = [UIFont systemFontOfSize:12];
[_countDownButton setBackgroundImage:[UIImage imageWithColor:UIColorRGBAlpha(0xFFFFFF, 0.4)] forState:UIControlStateNormal];
_countDownButton.layer.masksToBounds = YES;
_countDownButton.layer.cornerRadius = 13;
}
return _countDownButton;
}
- (UIStackView *)operaStackView {
if (!_operaStackView) {
_operaStackView = [[UIStackView alloc] init];
_operaStackView.axis = UILayoutConstraintAxisHorizontal;
_operaStackView.distribution = UIStackViewDistributionFillEqually;
_operaStackView.alignment = UIStackViewAlignmentFill;
_operaStackView.spacing = 12;
}
return _operaStackView;
}
- (UIButton *)rejectButton {
if (!_rejectButton) {\
_rejectButton = [UIButton buttonWithType:UIButtonTypeCustom];
_rejectButton.layer.masksToBounds = YES;
_rejectButton.layer.cornerRadius = 40 / 2;
[_rejectButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0xF4E0FF), UIColorFromRGB(0xF4E0FF)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_rejectButton setTitleColor:UIColorFromRGB(0x5486FD) forState:UIControlStateNormal];
[_rejectButton setTitle:@"拒绝" forState:UIControlStateNormal];
_rejectButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
[_rejectButton addTarget:self action:@selector(rejectButtonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _rejectButton;
}
- (UIButton *)acceptButton {
if (!_acceptButton) {
_acceptButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_acceptButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
[_acceptButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[_acceptButton setTitle:@"接受" forState:UIControlStateNormal];
_acceptButton.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
[_acceptButton addTarget:self action:@selector(acceptButtonAction:) forControlEvents:UIControlEventTouchUpInside];
_acceptButton.layer.masksToBounds = YES;
_acceptButton.layer.cornerRadius = 40 / 2;
}
return _acceptButton;
}
@end

View File

@@ -9,15 +9,15 @@
NS_ASSUME_NONNULL_BEGIN
@class AnchorPkRankModel;
@class AcrossRoomPkRankModel;
typedef NS_ENUM(NSInteger, AnchorPKPanelUserType) {
///红队贡献
AnchorPKPanelUserType_Red_Contribute = 1,
///红队魅力榜
AnchorPKPanelUserType_Red_Charm,
///蓝队魅力
AnchorPKPanelUserType_Blue_Contribute,
///蓝队贡献
AnchorPKPanelUserType_Blue_Contribute,
///蓝队魅力
AnchorPKPanelUserType_Blue_Charm,
};
@@ -26,7 +26,7 @@ typedef NS_ENUM(NSInteger, AnchorPKPanelUserType) {
///类型
@property (nonatomic,assign) AnchorPKPanelUserType type;
@property (nonatomic,strong, nullable) AnchorPkRankModel * panelInfo;
@property (nonatomic,strong, nullable) AcrossRoomPkRankModel * panelInfo;
@end

View File

@@ -14,11 +14,11 @@
#import "ThemeColor.h"
#import "UIImage+Utils.h"
///Model
#import "AnchorPKPanelModel.h"
#import "AcrossRoomPKPanelModel.h"
@interface XPAnchorPKPanelUserView ()
///
@property (nonatomic, strong) UIImageView *headwearImageView;
@property (nonatomic, strong) UIImageView *mvpImageView;
///
@property (nonatomic, strong) NetImageView *avatarImageView;
///
@@ -39,32 +39,33 @@
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.headwearImageView];
[self addSubview:self.avatarImageView];
[self addSubview:self.mvpImageView];
[self addSubview:self.coinButton];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(32);
make.height.mas_equalTo(38);
make.width.mas_equalTo(36);
make.height.mas_equalTo(42);
}];
[self.headwearImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.centerY.mas_equalTo(self);
make.height.mas_equalTo(38);
[self.mvpImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.bottom.right.mas_equalTo(self.avatarImageView);
make.height.mas_equalTo(11);
}];
[self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.mas_equalTo(self);
make.bottom.mas_equalTo(self.headwearImageView);
make.height.mas_equalTo(self.avatarImageView.mas_width);
make.top.mas_equalTo(self);
make.width.height.mas_equalTo(24);
make.centerX.mas_equalTo(self);
}];
[self.coinButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(32);
make.height.mas_equalTo(10);
make.bottom.centerX.mas_equalTo(self);
make.width.mas_equalTo(self);
make.height.mas_equalTo(11);
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.avatarImageView.mas_bottom).mas_offset(4);
}];
}
@@ -72,66 +73,59 @@
#pragma mark - getters and setters
- (void)setType:(AnchorPKPanelUserType)type {
_type = type;
NSString * headwearName;
NSString * avatarPlaceName;
UIColor * coinColorStart;
UIColor * coinColorEnd;
switch (type) {
case AnchorPKPanelUserType_Red_Contribute:
case AnchorPKPanelUserType_Blue_Contribute:
headwearName = @"room_across_pk_panel_contribute_head";
coinColorStart = UIColorFromRGB(0xFF9813);
coinColorEnd = UIColorFromRGB(0xFFB22B);
avatarPlaceName = @"room_across_pk_panel_contribute_avatar";
break;
case AnchorPKPanelUserType_Red_Charm:
avatarPlaceName = @"anchorPK_panel_red_micState";
break;
case AnchorPKPanelUserType_Blue_Contribute:
case AnchorPKPanelUserType_Blue_Charm:
headwearName = @"room_across_pk_panel_charm_head";
coinColorStart = UIColorFromRGB(0xFF5FC1);
coinColorEnd = UIColorFromRGB(0xFA81FF);
avatarPlaceName = @"room_across_pk_panel_charm_avatar";
avatarPlaceName = @"anchorPK_panel_blue_micState";
break;
default:
break;
}
self.headwearImageView.image = [UIImage imageNamed:headwearName];
self.avatarImageView.image = [UIImage imageNamed:avatarPlaceName];
[self.coinButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[coinColorStart, coinColorEnd] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal];
if (self.tag == 1000) {
self.headwearImageView.hidden = NO;
} else {
self.headwearImageView.hidden = YES;
}
}
- (void)setPanelInfo:(AnchorPkRankModel *)panelInfo {
- (void)setPanelInfo:(AcrossRoomPkRankModel *)panelInfo {
_panelInfo = panelInfo;
if (_panelInfo) {
self.avatarImageView.imageUrl = _panelInfo.avatar;
NSString * amount = _panelInfo.amount.length > 0 ? _panelInfo.amount : @"";
[self.coinButton setTitle:amount forState:UIControlStateNormal];
self.coinButton.hidden = !amount;
long long coinValue = [panelInfo.amount longLongValue];
NSString *value;
if (coinValue < 1000000) {
value = @(coinValue).stringValue;
} else if (coinValue >= 100000000) {
value = @"9999w+";
} else {
value = [NSString stringWithFormat:@"%lldw", coinValue/10000];
}
[self.coinButton setTitle:value forState:UIControlStateNormal];
self.coinButton.hidden = !panelInfo.amount;
} else {
if (self.type == AnchorPKPanelUserType_Red_Contribute || self.type == AnchorPKPanelUserType_Blue_Contribute) {
self.avatarImageView.image = [UIImage imageNamed:@"room_across_pk_panel_contribute_avatar"];
if (self.type == AnchorPKPanelUserType_Red_Contribute || self.type == AnchorPKPanelUserType_Red_Charm) {
self.avatarImageView.image = [UIImage imageNamed:@"anchorPK_panel_red_micState"];
} else {
self.avatarImageView.image = [UIImage imageNamed:@"room_across_pk_panel_charm_avatar"];
self.avatarImageView.image = [UIImage imageNamed:@"anchorPK_panel_red_micState"];
}
[self.coinButton setTitle:@"0" forState:UIControlStateNormal];
self.coinButton.hidden = YES;
}
if (self.tag == 1000) {
self.mvpImageView.hidden = NO;
}
}
- (UIImageView *)headwearImageView {
if (!_headwearImageView) {
_headwearImageView = [[UIImageView alloc] init];
_headwearImageView.userInteractionEnabled = YES;
- (UIImageView *)mvpImageView {
if (!_mvpImageView) {
_mvpImageView = [[UIImageView alloc] init];
_mvpImageView.image = [UIImage imageNamed:@"anchorPK_panel_MVP"];
_mvpImageView.hidden = YES;
}
return _headwearImageView;
return _mvpImageView;
}
- (NetImageView *)avatarImageView {
@@ -141,7 +135,7 @@
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_avatarImageView = [[NetImageView alloc] initWithConfig:config];
_avatarImageView.layer.masksToBounds = YES;
_avatarImageView.layer.cornerRadius = 32 / 2;
_avatarImageView.layer.cornerRadius = 24 / 2;
}
return _avatarImageView;
}
@@ -150,10 +144,7 @@
if (!_coinButton) {
_coinButton = [UIButton buttonWithType:UIButtonTypeCustom];
[_coinButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_coinButton.titleLabel.font = [UIFont systemFontOfSize:9 weight:UIFontWeightMedium];
_coinButton.layer.masksToBounds = YES;
_coinButton.layer.cornerRadius = 5;
_coinButton.hidden = YES;
_coinButton.titleLabel.font = [UIFont systemFontOfSize:10];
}
return _coinButton;
}

View File

@@ -6,15 +6,108 @@
//
#import "XPAnchorPKRuleView.h"
///Third
#import <Masonry/Masonry.h>
///Tool
#import "ThemeColor.h"
#import "TTPopup.h"
@interface XPAnchorPKRuleView ()
///
@property (nonatomic, strong) UILabel *titleLabel;
///
@property (nonatomic, strong) UIImageView *backgroundImageView;
@property (nonatomic, strong) UIView *firstLineView;
@property (nonatomic, strong) UILabel *firstLineLabel;
///
@property (nonatomic, strong) UITextView *ruleTextView;
@property (nonatomic, strong) UIView *secondLineView;
@property (nonatomic, strong) UILabel *secondLineLabel;
@property (nonatomic, strong) UITextView *secondTextView;
@end
@implementation XPAnchorPKRuleView
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
- (instancetype)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
[self initSubViews];
[self initSubViewConstraints];
}
return self;
}
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backgroundImageView];
[self addSubview:self.titleLabel];
[self addSubview:self.ruleTextView];
}
- (void)initSubViewConstraints {
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(300);
make.height.mas_equalTo(306);
make.bottom.mas_equalTo(self.backgroundImageView.mas_bottom);
}];
[self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.edges.mas_equalTo(0);
}];
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self.backgroundImageView).mas_offset(64);
}];
[self.ruleTextView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(23);
make.left.mas_equalTo(17);
make.right.mas_equalTo(-18);
make.bottom.mas_equalTo(-17);
}];
}
#pragma mark - Event Response
- (void)closeBtnClick:(UIButton *)button {
[TTPopup dismiss];
}
#pragma mark - Getters And Setters
- (UIImageView *)backgroundImageView {
if (!_backgroundImageView) {
_backgroundImageView = [[UIImageView alloc] init];
_backgroundImageView.image = [UIImage imageNamed:@"anchorPK_invite_bg"];
}
return _backgroundImageView;
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.text = @"PK规则";
_titleLabel.textColor = [UIColor whiteColor];
_titleLabel.font = [UIFont systemFontOfSize:15];
}
return _titleLabel;
}
- (UITextView *)ruleTextView {
if (!_ruleTextView) {
_ruleTextView = [[UITextView alloc] init];
_ruleTextView.textColor = UIColorFromRGB(0xffffff);
_ruleTextView.backgroundColor = [UIColor clearColor];
_ruleTextView.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
_ruleTextView.scrollEnabled = NO;
_ruleTextView.editable = NO;
_ruleTextView.text = @"1只有牌照房房主和超管才可以发起跨房pk一次只能选择一个牌照房发起\n2只有房主和超管才可以接受或拒绝跨房pk请求若10秒内不点击pk邀请弹窗弹窗消失视为自动拒绝\n3发起pk时需选择pk时间和pk对象自定义时间下限为5上限为180只能填写整数\n4pk发起后未到pk时间无法自行结束若有特殊情况需提前结束可联系客服但本场pk不算胜负。\n";
}
return _ruleTextView;
}
*/
@end

View File

@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@class XPAnchorPkPanelView, AnchorPKPanelModel;
@class XPAnchorPkPanelView, AcrossRoomPKPanelModel;
@protocol XPAnchorPkPanelViewDelegate <NSObject>
///展示用户卡片
@@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN
///开启pk
- (void)openCountdownWithTime:(long)time;
///pk 信息
@property (nonatomic,strong, nullable) AnchorPKPanelModel *pkPanelInfo;
@property (nonatomic,strong, nullable) AcrossRoomPKPanelModel *pkPanelInfo;
///代理
@property (nonatomic,weak) id<XPAnchorPkPanelViewDelegate> delegate;
///重置数据

View File

@@ -17,7 +17,7 @@
#import "Timestamp.h"
///Model
#import "UserInfoModel.h"
#import "AnchorPKPanelModel.h"
#import "AcrossRoomPKPanelModel.h"
///View
#import "XPAnchorPKPanelUserView.h"
@@ -47,7 +47,8 @@
@property (nonatomic, strong) UIImageView *buleCountImageView;
///
@property (nonatomic, strong) UILabel *buleCountLabel;
#pragma mark -
///
@property (nonatomic, strong) UIImageView *middleImageView;
#pragma mark - view
///
@property (nonatomic,strong) UIStackView *redContributeStackView;
@@ -55,6 +56,17 @@
@property (nonatomic,strong) UIStackView *blueContributeStackView;
///
@property (strong, nonatomic) dispatch_source_t timer;
///
@property (nonatomic, strong) NetImageView *otherAvatarImageView;
///PK
@property (nonatomic, strong) UIImageView *otherResultImageView;
///
@property (nonatomic, strong) UIStackView *otherStackView;
///
@property (nonatomic, strong) UILabel *otherNickLabel;
///
@property (nonatomic, strong) UIButton *followButton;
@end
@implementation XPAnchorPkPanelView
@@ -84,21 +96,29 @@
#pragma mark - Private Method
- (void)initSubViews {
self.userInteractionEnabled = NO;
[self addSubview:self.backImageView];
[self.backImageView addSubview:self.timeLabel];
[self.backImageView addSubview:self.redStarImageView];
[self.backImageView addSubview:self.blueStarImageView];
[self.backImageView addSubview:self.progressView];
///
[self.backImageView addSubview:self.progressView];
[self.progressView addSubview:self.progressContentView];
[self.progressContentView addSubview:self.redCountImageView];
[self.progressContentView addSubview:self.buleCountImageView];
[self.progressContentView addSubview:self.redCountLabel];
[self.progressContentView addSubview:self.buleCountLabel];
///
[self.backImageView addSubview:self.redContributeStackView];
[self.backImageView addSubview:self.blueContributeStackView];
[self.progressContentView addSubview:self.redCountLabel];
[self.progressContentView addSubview:self.buleCountLabel];
[self.backImageView addSubview:self.redStarImageView];
[self.backImageView addSubview:self.blueStarImageView];
[self.backImageView addSubview:self.middleImageView];
[self addSubview:self.otherAvatarImageView];
[self addSubview:self.otherResultImageView];
[self addSubview:self.otherStackView];
[self.otherStackView addArrangedSubview:self.otherNickLabel];
[self.otherStackView addArrangedSubview:self.followButton];
[self initUserSubViews];
}
@@ -140,12 +160,12 @@
}];
[self.redStarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(15);
make.top.mas_equalTo(self.backImageView).mas_offset(15);
make.left.mas_equalTo(-30);
make.width.height.mas_equalTo(26);
}];
[self.blueStarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(15);
make.top.mas_equalTo(self.redStarImageView);
make.left.mas_equalTo(self.backImageView.mas_right).mas_offset(4);
make.width.height.mas_equalTo(26);
}];
@@ -153,9 +173,9 @@
///
[self.progressView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.backImageView);
make.width.mas_equalTo(174);
make.height.mas_equalTo(12);
make.top.mas_equalTo(self.mas_bottom).offset(8);
make.width.mas_equalTo(305);
make.height.mas_equalTo(16);
make.centerY.mas_equalTo(self.redStarImageView);
}];
[self.progressContentView mas_makeConstraints:^(MASConstraintMaker *make) {
@@ -164,35 +184,65 @@
[self.redCountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(0);
make.height.mas_equalTo(12);
make.height.mas_equalTo(16);
make.top.mas_equalTo(0);
make.right.mas_equalTo(self.buleCountImageView.mas_left);
}];
[self.redCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.progressContentView.mas_left).offset(6);
make.left.mas_equalTo(self.progressContentView.mas_left).offset(17);
make.centerY.mas_equalTo(self.progressContentView);
}];
[self.buleCountImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(0);
make.height.mas_equalTo(12);
make.height.mas_equalTo(self.redCountImageView);
make.centerY.mas_equalTo(self.redCountImageView);
make.width.mas_equalTo(174 * 0.5);
make.width.mas_equalTo(305 * 0.5);
}];
[self.buleCountLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.mas_equalTo(self.progressContentView.mas_right).offset(-6);
make.right.mas_equalTo(self.progressContentView.mas_right).offset(-17);
make.centerY.mas_equalTo(self.progressContentView);
}];
[self.middleImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.buleCountImageView.mas_left);
make.centerY.mas_equalTo(self.progressView);
make.height.mas_equalTo(26);
make.width.mas_equalTo(40);
}];
[self.redContributeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.bottom.mas_equalTo(self.backImageView);
make.left.mas_equalTo(self.backImageView).mas_offset(12);
make.height.mas_equalTo(42);
}];
[self.blueContributeStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(self.redContributeStackView);
make.right.mas_equalTo(self.backImageView).mas_offset(-12);
make.bottom.mas_equalTo(self.redContributeStackView);
}];
///
[self.otherAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.mas_equalTo(self.mas_centerX).mas_offset(58);
make.top.mas_equalTo(87);
make.width.height.mas_equalTo(90 * kScreenScale);
}];
[self.otherResultImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self.otherAvatarImageView);
make.bottom.mas_equalTo(self.otherAvatarImageView).mas_offset(12);
make.width.mas_equalTo(66);
make.height.mas_equalTo(48);
}];
[self.otherStackView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.otherAvatarImageView.mas_bottom).mas_offset(17);
make.centerX.mas_equalTo(self.otherAvatarImageView);
make.height.mas_equalTo(20);
}];
[self.followButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.size.mas_equalTo(CGSizeMake(50, 20));
}];
}
@@ -252,8 +302,12 @@
}
}
- (void)onFollowButtonClick:(UIButton *)button {
}
#pragma mark - getters and setters
- (void)setPkPanelInfo:(AnchorPKPanelModel *)pkPanelInfo {
- (void)setPkPanelInfo:(AcrossRoomPKPanelModel *)pkPanelInfo {
_pkPanelInfo = pkPanelInfo;
if (_pkPanelInfo) {
[Timestamp getInternetDateWithSuccess:^(NSTimeInterval timeInterval) {
@@ -278,7 +332,7 @@
self.redCountLabel.text = [NSString stringWithFormat:@"%lld", _pkPanelInfo.cAmount];
self.buleCountLabel.text = [NSString stringWithFormat:@"%lld", _pkPanelInfo.aAmount];
for (int i = 0; i<_pkPanelInfo.csRank.count; i++) {
AnchorPkRankModel * rankModel = [_pkPanelInfo.csRank objectAtIndex:i];
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.csRank objectAtIndex:i];
if (i >= self.redContributeStackView.subviews.count) {
break;
}
@@ -287,7 +341,7 @@
}
for (int i = 0; i<_pkPanelInfo.asRank.count; i++) {
AnchorPkRankModel * rankModel = [_pkPanelInfo.asRank objectAtIndex:i];
AcrossRoomPkRankModel * rankModel = [_pkPanelInfo.asRank objectAtIndex:i];
if (i >= self.blueContributeStackView.subviews.count) {
break;
}
@@ -298,10 +352,12 @@
if (_pkPanelInfo.aPercent > 1) {
_pkPanelInfo.aPercent = 1;
}
CGFloat width = 174;
CGFloat width = 305;
[self.buleCountImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width * _pkPanelInfo.aPercent);
}];
self.otherAvatarImageView.imageUrl = pkPanelInfo.aAvatar;
self.otherNickLabel.text = pkPanelInfo.aTitle;
} else {
self.redCountLabel.text = @"0";
self.buleCountLabel.text = @"0";
@@ -314,7 +370,7 @@
userView.panelInfo = nil;
}
CGFloat width = 174;
CGFloat width = 305;
[self.buleCountImageView mas_updateConstraints:^(MASConstraintMaker *make) {
make.width.mas_equalTo(width * 0.5);
}];
@@ -361,8 +417,6 @@
if (!_progressContentView) {
_progressContentView = [[UIView alloc] init];
_progressContentView.backgroundColor = [UIColor clearColor];
_progressContentView.layer.cornerRadius = 6;
_progressContentView.layer.masksToBounds = YES;
}
return _progressContentView;
}
@@ -378,7 +432,7 @@
- (UIImageView *)redCountImageView {
if (!_redCountImageView) {
_redCountImageView = [[UIImageView alloc] init];
_redCountImageView.backgroundColor = UIColorFromRGB(0xFF4D73);
_redCountImageView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"anchorPK_panel_red_progress"]];
}
return _redCountImageView;
}
@@ -397,7 +451,7 @@
- (UIImageView *)buleCountImageView {
if (!_buleCountImageView) {
_buleCountImageView = [[UIImageView alloc] init];
_buleCountImageView.backgroundColor = UIColorFromRGB(0x45C0FF);
_buleCountImageView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"anchorPK_panel_blue_progress"]];
}
return _buleCountImageView;
}
@@ -433,4 +487,63 @@
return _blueContributeStackView;
}
- (UIImageView *)middleImageView {
if (!_middleImageView) {
_middleImageView = [[UIImageView alloc] init];
_middleImageView.image = [UIImage imageNamed:@"anchorPK_panel_middle_indicator"];
}
return _middleImageView;
}
- (NetImageView *)otherAvatarImageView {
if (!_otherAvatarImageView) {
NetImageConfig * config = [[NetImageConfig alloc]init];
config.imageType = ImageTypeUserIcon;
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
_otherAvatarImageView = [[NetImageView alloc] initWithConfig:config];
_otherAvatarImageView.layer.masksToBounds = YES;
_otherAvatarImageView.layer.cornerRadius = 90 * kScreenScale / 2;
}
return _otherAvatarImageView;
}
- (UIImageView *)otherResultImageView {
if (!_otherResultImageView) {
_otherResultImageView = [[UIImageView alloc] init];
_otherResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_win"];
}
return _otherResultImageView;
}
- (UIStackView *)otherStackView {
if (!_otherStackView) {
_otherStackView = [[UIStackView alloc] init];
_otherStackView.axis = UILayoutConstraintAxisHorizontal;
_otherStackView.distribution = UIStackViewDistributionFill;
_otherStackView.alignment = UIStackViewAlignmentCenter;
_otherStackView.spacing = 2;
}
return _otherStackView;
}
- (UILabel *)otherNickLabel {
if (!_otherNickLabel) {
_otherNickLabel = [[UILabel alloc] init];
_otherNickLabel.font = [UIFont systemFontOfSize:12];
_otherNickLabel.textColor = [UIColor whiteColor];
_otherNickLabel.textAlignment = NSTextAlignmentCenter;
}
return _otherNickLabel;
}
- (UIButton *)followButton {
if (!_followButton) {
_followButton = [[UIButton alloc] init];
[_followButton setImage:[UIImage imageNamed:@"anchorPk_micro_follow"] forState:UIControlStateNormal];
[_followButton addTarget:self action:@selector(onFollowButtonClick:) forControlEvents:UIControlEventTouchUpInside];
}
return _followButton;
}
@end

View File

@@ -9,10 +9,10 @@
NS_ASSUME_NONNULL_BEGIN
@class XPAnchorPKSelectRoomView, AnchorPKInfoModel;
@class XPAnchorPKSelectRoomView, AcrossRoomPKInfoModel;
@protocol XPAnchorPKSelectRoomViewDelegate <NSObject>
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AnchorPKInfoModel *)pkRoomInfo;
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AcrossRoomPKInfoModel *)pkRoomInfo;
@end

View File

@@ -16,7 +16,7 @@
#import "Api+AnchorPk.h"
#import "XPMacro.h"
///Model
#import "AnchorPKInfoModel.h"
#import "AcrossRoomPKInfoModel.h"
///View
#import "XPAcrossRoomPKEmptyTableViewCell.h"
#import "XPAnchorPKTableViewCell.h"
@@ -39,7 +39,7 @@
///
@property (nonatomic,assign) BOOL hasNoMoreData;
///PK
@property (nonatomic, strong) AnchorPKInfoModel *selectRoomInfo;
@property (nonatomic, strong) AcrossRoomPKInfoModel *selectRoomInfo;
@end
@@ -121,7 +121,7 @@
self.page = 1;
[Api getAnchorPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray * array = [AnchorPKInfoModel modelsWithArray:data.data];
NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data];
[self getAcrossRoomPKListSuccess:array state:0];
} else {
[XCHUDTool showErrorWithMessage:msg];
@@ -137,7 +137,7 @@
self.page++;
[Api getAnchorPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
NSArray * array = [AnchorPKInfoModel modelsWithArray:data.data];
NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data];
[self getAcrossRoomPKListSuccess:array state:1];
} else {
[XCHUDTool showErrorWithMessage:msg];
@@ -178,7 +178,7 @@
cell = [[XPAnchorPKTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAnchorPKTableViewCell class])];
}
cell.delegate = self;
AnchorPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row];
AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row];
if (pkRoomInfo.uid.integerValue == self.selectRoomInfo.uid.integerValue) {
pkRoomInfo.hadSelected = YES;
} else {
@@ -204,7 +204,7 @@
}
#pragma mark - XPAnchorPKTableViewCellDelegate
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AnchorPKInfoModel *)roomInfo {
- (void)xPAnchorPKTableViewCell:(XPAnchorPKTableViewCell *)view didChooseRoom:(AcrossRoomPKInfoModel *)roomInfo {
// if (self.selectRoomInfo && roomInfo.uid == self.selectRoomInfo.uid) {///
// [self.tableView reloadData];
// self.selectRoomInfo = nil;
@@ -233,7 +233,7 @@
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];
NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data];
[self getAcrossRoomPKListSuccess:array state:0];
} else {
[XCHUDTool showErrorWithMessage:msg];

View File

@@ -16,7 +16,7 @@
#import "UIImage+Utils.h"
#import "TTPopup.h"
///Model
#import "AnchorPKInfoModel.h"
#import "AcrossRoomPKInfoModel.h"
///View
#import "XPAnchorPKSelectRoomView.h"
#import "XPAcrossRoomPKRuleView.h"
@@ -71,7 +71,7 @@
///
@property (nonatomic, strong) UIButton *cancelButon;
///PK
@property (nonatomic, strong) AnchorPKInfoModel *selectRoomInfo;
@property (nonatomic, strong) AcrossRoomPKInfoModel *selectRoomInfo;
///PK
@property (nonatomic, assign) NSInteger pkDuration;
///PK
@@ -240,7 +240,7 @@
}
- (void)updateDoneButtonState {
if (self.selectRoomInfo && self.pkDuration >= 5 && self.pkDuration <= 180) {
if (self.selectRoomInfo && self.pkDuration >= 5 && self.pkDuration <= 30) {
self.doneButton.enabled = YES;
} else {
self.doneButton.enabled = NO;
@@ -270,7 +270,7 @@
#pragma mark - XPAnchorPKSelectRoomViewDelegate
///PK
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AnchorPKInfoModel *)pkRoomInfo {
- (void)XPAnchorPKSelectRoomView:(XPAnchorPKSelectRoomView *)view didChoosePKRoom:(AcrossRoomPKInfoModel *)pkRoomInfo {
if (pkRoomInfo) {
[self.userStackView mas_updateConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(60);
@@ -294,7 +294,7 @@
NSString *countStr = [self.customTimeTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSInteger count = [countStr integerValue];
if (count > 180) {
[self showErrorToast:@"PK时长最长为180分钟"];
[self showErrorToast:@"PK时长最长为30分钟"];
} else if(count < 5) {
[self showErrorToast:@"PK时长最短为5分钟"];
}
@@ -532,7 +532,7 @@
_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.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"自定义(5-30)分钟" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: UIColorFromRGB(0xC6C6E9)}];
[_customTimeTextField addTarget:self action:@selector(textFieldDidChanged:) forControlEvents:UIControlEventEditingChanged];
}

View File

@@ -35,7 +35,7 @@
#import "XPAnchorFansRelationModel.h"
#import "XPAnchorFansJoinModel.h"
#import "XPAnchorFansTaskModel.h"
#import "AnchorPKPanelModel.h"
#import "AcrossRoomPKPanelModel.h"
///View
#import "XPRoomHalfWebView.h"
#import "XPAnchorAudienceUpMicView.h"
@@ -48,6 +48,8 @@
#import "XPAcrpssRoomPKPanelView.h"
#import "XPAcrossRoomPKResultView.h"
#import "XPAcrossRoomPKForceEndResultView.h"
#import "XPAnchorPKInviteView.h"
#import "XPAnchorPKRuleView.h"
#import "XPSendGiftView.h"
#import "XPUserCardViewController.h"
#import "XPRoomViewController.h"
@@ -323,48 +325,38 @@
if (roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
[Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
if (acrossPKPanelInfo.aUid.integerValue > 0) {
if (!self.acrossPKPanelView.superview) {
[self addSubview:self.acrossPKPanelView];
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
}];
}
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) {
if (acrossPKPanelInfo.aUid.integerValue > 0) {
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
}];
}
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
} else {
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
if (acrossPKPanelInfo.aUid.integerValue > 0) {
if (!self.acrossPKPanelView.superview) {
[self addSubview:self.acrossPKPanelView];
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
}];
}
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
}
// [Api requestEndAnchorRoomPk:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
// NSLog(@"%@", msg);
// } roundId:[NSString stringWithFormat:@"%ld", acrossPKPanelInfo.roundId]];
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:roomUid];
} else if (roomInfo.roomModeType == RoomModeType_Open_AnchorPK_Mode) {
[Api getAcrossRoomPKDetail:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
if (code == 200) {
AnchorPKPanelModel * anchorPKPanelInfo = [AnchorPKPanelModel modelWithJSON:data.data];
if (anchorPKPanelInfo.aUid.integerValue > 0) {
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.bottom.mas_equalTo(330);
}];
}
self.anchorPKPanelView.pkPanelInfo = anchorPKPanelInfo;
}
} else {
[XCHUDTool showErrorWithMessage:msg];
}
} roomUid:roomUid];
} else {
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
make.left.mas_equalTo(0);
}];
}
}
if (roomInfo.type == RoomType_Anchor) {
[self.contributionButton setTitle:@"主播榜" forState:UIControlStateNormal];
@@ -508,6 +500,7 @@
}
}
break;
///PK
case Custom_Message_Sub_AnchorPK_Invite:
{
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
@@ -517,7 +510,7 @@
if (error == nil) {
NIMChatroomMember * member = [members firstObject];
if (member.type == NIMTeamMemberTypeOwner) {
XPAcrossRoomPKInviteView * inviteView = [[XPAcrossRoomPKInviteView alloc] init];
XPAnchorPKInviteView * inviteView = [[XPAnchorPKInviteView alloc] init];
inviteView.roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
inviteView.dataDic = attachment.data;
[self addSubview:inviteView];
@@ -582,21 +575,34 @@
break;
case Custom_Message_Sub_AnchorPK_Panel:
{
if (!self.acrossPKPanelView.superview) {
[self addSubview:self.acrossPKPanelView];
[self.acrossPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self).offset(354 + kSafeAreaTopHeight);
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
}];
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
self.acrossPKPanelView.pkPanelInfo = acrossPKPanelInfo;
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
break;
case Custom_Message_Sub_AnchorPK_End:
{
[self.acrossPKPanelView resetAcrossPKViewData];
[self.acrossPKPanelView removeFromSuperview];
if (!self.anchorPKPanelView.superview) {
[self addSubview:self.anchorPKPanelView];
[self.anchorPKPanelView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.mas_equalTo(self);
make.top.mas_equalTo(kNavigationHeight);
}];
}
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
self.anchorPKPanelView.pkPanelInfo = acrossPKPanelInfo;
}
break;
case Custom_Message_Sub_AnchorPK_Finish:
{
[self.anchorPKPanelView resetAcrossPKViewData];
[self.anchorPKPanelView removeFromSuperview];
AcrossRoomPKPanelModel * model = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
if (model.isForce) {
XPAcrossRoomPKForceEndResultView *view = [[XPAcrossRoomPKForceEndResultView alloc] initWithFrame:CGRectMake(0, 0, 281, 208)];

View File

@@ -96,6 +96,14 @@
make.width.height.mas_equalTo(22);
}];
}
[self.stackView mas_updateConstraints:^(MASConstraintMaker *make) {
make.top.mas_equalTo(self.avatarImageView.mas_bottom).mas_offset(17);
}];
}
- (void)configUser:(UserInfoModel *)userInfo {
[super configUser:userInfo];
self.sexImageView.hidden = YES;
}
#pragma mark - event

View File

@@ -275,10 +275,10 @@ UIKIT_EXTERN NSString * const kRoomMiniNotificationKey;
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[SocialStageView alloc] initWithDelegate:self];
} else if (self.roomInfo.type == RoomType_Anchor && ![self.stageView isKindOfClass:[AnchorPKStageView class]]) {
} else if (self.roomInfo.type == RoomType_Anchor && ![self.stageView isKindOfClass:[AnchorStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;
self.stageView = [[AnchorPKStageView alloc] initWithDelegate:self];
self.stageView = [[AnchorStageView alloc] initWithDelegate:self];
} else if(self.roomInfo.type == RoomType_MiniGame && ![self.stageView isKindOfClass:[LittleGameStageView class]]) {
[self.stageView removeFromSuperview];
self.stageView = nil;