个播PK规则、关注房主、连麦优化
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 5.6 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "anchorPK_result_blueValue_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "anchorPK_result_blueValue_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "anchorPK_result_redValue_bg@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "anchorPK_result_redValue_bg@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_anchorPK_close@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_anchorPK_close@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.5 KiB |
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"idiom" : "universal",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_anchorPK_open@2x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"filename" : "room_more_menu_anchorPK_open@3x.png",
|
||||
"idiom" : "universal",
|
||||
"scale" : "3x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
After Width: | Height: | Size: 2.5 KiB |
After Width: | Height: | Size: 3.6 KiB |
@@ -154,6 +154,10 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/// @param teamUid 房间uid
|
||||
+ (void)requestFansTeamTask:(HttpRequestHelperCompletion)completion teamUid:(NSString *)teamUid;
|
||||
|
||||
/// 获取个播PK规则
|
||||
/// @param completion 完成
|
||||
+ (void)requestAnchorPkRule:(HttpRequestHelperCompletion)completion;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -174,5 +174,10 @@
|
||||
[self makeRequest:@"anchorFansTeam/getFansTaskInfo" method:HttpRequestHelperMethodGET completion:completion, __FUNCTION__, teamUid, nil];
|
||||
}
|
||||
|
||||
/// 获取个播PK规则
|
||||
/// @param completion 完成
|
||||
+ (void)requestAnchorPkRule:(HttpRequestHelperCompletion)completion {
|
||||
[self makeRequest:@"crossroompkround/getSingleRoomPkRule" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -128,6 +128,10 @@ typedef NS_ENUM(NSInteger, RoomDatingStateChangeType) {
|
||||
@property (nonatomic, copy) NSString *mgName;
|
||||
///pk场次id(本地字段)
|
||||
@property (nonatomic, assign) NSInteger roundId;
|
||||
///PK中的对方UID(本地字段)
|
||||
@property (nonatomic, copy) NSString *pkUid;
|
||||
///PK中的对方房间roomId(本地字段)
|
||||
@property (nonatomic, copy) NSString *pkRoomId;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -67,6 +67,8 @@ typedef NS_ENUM(NSUInteger, AcrossRoomPkStateType) {
|
||||
@property (nonatomic, assign) AcrossRoomPkStateType pkState;
|
||||
///场次id
|
||||
@property (nonatomic, assign) NSInteger roundId;
|
||||
///对方的房间id
|
||||
@property (nonatomic, copy) NSString *aRoomId;
|
||||
@end
|
||||
|
||||
@interface AcrossRoomPkRankModel : NSObject
|
||||
|
@@ -141,6 +141,10 @@
|
||||
[self.blueRoomTitleLabel mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.blueHeadImageView.mas_bottom).mas_offset(4);
|
||||
}];
|
||||
[self.middleImageView mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.mas_equalTo(46);
|
||||
make.height.mas_equalTo(39);
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -100,13 +100,13 @@
|
||||
[self.redValueBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.redAvatarImageView.mas_bottom).mas_offset(6);
|
||||
make.height.mas_equalTo(26);
|
||||
make.width.mas_equalTo(101);
|
||||
make.width.mas_equalTo(110);
|
||||
make.centerX.mas_equalTo(self.redAvatarImageView);
|
||||
}];
|
||||
[self.blueValueBgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerY.mas_equalTo(self.redValueBgImageView);
|
||||
make.height.mas_equalTo(26);
|
||||
make.width.mas_equalTo(101);
|
||||
make.width.mas_equalTo(110);
|
||||
make.centerX.mas_equalTo(self.blueAvatarImageView);
|
||||
}];
|
||||
[self.redValueLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -126,11 +126,11 @@
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
|
||||
- (void)setData:(AcrossRoomPkRankModel *)data {
|
||||
// self.redAvatarImageView.imageUrl = data.a
|
||||
// self.titleLabel.text = data.nick ? data.nick : @"";
|
||||
// self.contentLabel.text = [NSString stringWithFormat:@"PK值:%@", data.amount? data.amount : @""];
|
||||
// self.headImageView.imageUrl = data.avatar;
|
||||
- (void)setData:(AcrossRoomPKPanelModel *)data {
|
||||
self.redValueLabel.text = [NSString stringWithFormat:@"%lld", data.cAmount];
|
||||
self.blueValueLabel.text = [NSString stringWithFormat:@"%lld", data.aAmount];
|
||||
self.redAvatarImageView.imageUrl = data.cAvatar;
|
||||
self.blueAvatarImageView.imageUrl = data.aAvatar;
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
@@ -192,7 +192,7 @@
|
||||
- (UIImageView *)redValueBgImageView {
|
||||
if (!_redValueBgImageView) {
|
||||
_redValueBgImageView = [[UIImageView alloc] init];
|
||||
_redValueBgImageView.image = [UIImage imageNamed:@"anchorPK_invite_bg"];
|
||||
_redValueBgImageView.image = [UIImage imageNamed:@"anchorPK_result_redValue_bg"];
|
||||
}
|
||||
return _redValueBgImageView;
|
||||
}
|
||||
@@ -200,7 +200,7 @@
|
||||
- (UIImageView *)blueValueBgImageView {
|
||||
if (!_blueValueBgImageView) {
|
||||
_blueValueBgImageView = [[UIImageView alloc] init];
|
||||
_blueValueBgImageView.image = [UIImage imageNamed:@"anchorPK_invite_bg"];
|
||||
_blueValueBgImageView.image = [UIImage imageNamed:@"anchorPK_result_blueValue_bg"];
|
||||
}
|
||||
return _blueValueBgImageView;
|
||||
}
|
||||
|
@@ -154,6 +154,7 @@
|
||||
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self);
|
||||
make.top.mas_equalTo(self.backImageView).mas_offset(64);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
|
||||
[self.countDownButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
@@ -236,7 +237,7 @@
|
||||
}else{
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
@kStrongify(self);
|
||||
[self.countDownButton setTitle:[NSString stringWithFormat:@"%02ld", time] forState:UIControlStateNormal];
|
||||
[self.countDownButton setTitle:[NSString stringWithFormat:@"%02lds", time] forState:UIControlStateNormal];
|
||||
});
|
||||
time--;
|
||||
}
|
||||
|
@@ -94,16 +94,7 @@
|
||||
_panelInfo = panelInfo;
|
||||
if (_panelInfo) {
|
||||
self.avatarImageView.imageUrl = _panelInfo.avatar;
|
||||
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 setTitle:panelInfo.amount forState:UIControlStateNormal];
|
||||
self.coinButton.hidden = !panelInfo.amount;
|
||||
} else {
|
||||
if (self.type == AnchorPKPanelUserType_Red_Contribute || self.type == AnchorPKPanelUserType_Red_Charm) {
|
||||
|
@@ -11,6 +11,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface XPAnchorPKRuleView : UIView
|
||||
|
||||
@property (nonatomic, copy) NSString *ruleString;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -18,18 +18,10 @@
|
||||
@property (nonatomic, strong) UILabel *titleLabel;
|
||||
///背景
|
||||
@property (nonatomic, strong) UIImageView *backgroundImageView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *firstLineView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *firstLineLabel;
|
||||
///显示内容
|
||||
@property (nonatomic, strong) UITextView *ruleTextView;
|
||||
|
||||
@property (nonatomic, strong) UIImageView *secondLineView;
|
||||
|
||||
@property (nonatomic, strong) UILabel *secondLineLabel;
|
||||
|
||||
@property (nonatomic, strong) UITextView *secondTextView;
|
||||
///关闭
|
||||
@property (nonatomic, strong) UIButton *closeBtn;
|
||||
|
||||
@end
|
||||
|
||||
@@ -48,12 +40,8 @@
|
||||
- (void)initSubViews {
|
||||
[self addSubview:self.backgroundImageView];
|
||||
[self addSubview:self.titleLabel];
|
||||
[self addSubview:self.firstLineView];
|
||||
[self addSubview:self.firstLineLabel];
|
||||
[self addSubview:self.ruleTextView];
|
||||
[self addSubview:self.secondLineView];
|
||||
[self addSubview:self.secondLineLabel];
|
||||
[self addSubview:self.secondTextView];
|
||||
[self addSubview:self.closeBtn];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
@@ -70,45 +58,27 @@
|
||||
make.top.mas_equalTo(self.backgroundImageView).mas_offset(64);
|
||||
make.height.mas_equalTo(21);
|
||||
}];
|
||||
[self.firstLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(30);
|
||||
make.height.mas_equalTo(8);
|
||||
make.width.mas_equalTo(88);
|
||||
make.centerX.mas_equalTo(self);
|
||||
}];
|
||||
[self.firstLineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.firstLineView);
|
||||
make.bottom.mas_equalTo(self.firstLineView);
|
||||
}];
|
||||
[self.ruleTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.firstLineView.mas_bottom).mas_offset(8);
|
||||
make.left.mas_equalTo(17);
|
||||
make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(30);
|
||||
make.left.mas_equalTo(18);
|
||||
make.right.mas_equalTo(-18);
|
||||
make.height.mas_equalTo(56);
|
||||
make.bottom.mas_equalTo(-20);
|
||||
}];
|
||||
[self.secondLineView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.ruleTextView.mas_bottom).mas_offset(26);
|
||||
make.height.mas_equalTo(8);
|
||||
make.width.mas_equalTo(88);
|
||||
make.centerX.mas_equalTo(self);
|
||||
}];
|
||||
[self.firstLineLabel mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.secondLineView);
|
||||
make.bottom.mas_equalTo(self.secondLineView);
|
||||
}];
|
||||
[self.secondTextView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.secondLineView.mas_bottom).mas_offset(8);
|
||||
make.left.mas_equalTo(17);
|
||||
make.right.mas_equalTo(-18);
|
||||
make.height.mas_equalTo(35);
|
||||
[self.closeBtn mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.right.top.mas_equalTo(self.backgroundImageView);
|
||||
make.width.height.mas_equalTo(32);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)closeBtnClick:(UIButton *)button {
|
||||
- (void)onCloseBtnClick:(UIButton *)button {
|
||||
[TTPopup dismiss];
|
||||
}
|
||||
|
||||
- (void)setRuleString:(NSString *)ruleString {
|
||||
self.ruleTextView.text = ruleString;
|
||||
}
|
||||
|
||||
#pragma mark - Getters And Setters
|
||||
- (UIImageView *)backgroundImageView {
|
||||
if (!_backgroundImageView) {
|
||||
@@ -128,69 +98,26 @@
|
||||
return _titleLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)firstLineView {
|
||||
if (!_firstLineView) {
|
||||
_firstLineView = [[UIImageView alloc] init];
|
||||
_firstLineView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x58ECFF), UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_firstLineView.layer.cornerRadius = 4;
|
||||
_firstLineView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _firstLineView;
|
||||
}
|
||||
|
||||
- (UILabel *)firstLineLabel {
|
||||
if (!_firstLineLabel) {
|
||||
_firstLineLabel = [[UILabel alloc] init];
|
||||
_firstLineLabel.text = @"什么是PK";
|
||||
_firstLineLabel.textColor = [ThemeColor mainTextColor];
|
||||
_firstLineLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _firstLineLabel;
|
||||
}
|
||||
|
||||
- (UIImageView *)secondLineView {
|
||||
if (!_secondLineView) {
|
||||
_secondLineView = [[UIImageView alloc] init];
|
||||
_secondLineView.image = [UIImage gradientColorImageFromColors:@[UIColorFromRGB(0x58ECFF), UIColorFromRGB(0x1CD7FD), UIColorFromRGB(0x9377FF), UIColorFromRGB(0xFF6BA3)] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)];
|
||||
_secondLineView.layer.cornerRadius = 4;
|
||||
_secondLineView.layer.masksToBounds = YES;
|
||||
}
|
||||
return _secondLineView;
|
||||
}
|
||||
|
||||
- (UILabel *)secondLineLabel {
|
||||
if (!_secondLineLabel) {
|
||||
_secondLineLabel = [[UILabel alloc] init];
|
||||
_secondLineLabel.text = @"首杀暴击";
|
||||
_firstLineLabel.textColor = [ThemeColor mainTextColor];
|
||||
_firstLineLabel.font = [UIFont systemFontOfSize:12 weight:UIFontWeightMedium];
|
||||
}
|
||||
return _secondLineLabel;
|
||||
}
|
||||
|
||||
- (UITextView *)ruleTextView {
|
||||
if (!_ruleTextView) {
|
||||
_ruleTextView = [[UITextView alloc] init];
|
||||
_ruleTextView.textColor = UIColorFromRGB(0xffffff);
|
||||
_ruleTextView.textColor = [ThemeColor mainTextColor];
|
||||
_ruleTextView.backgroundColor = [UIColor clearColor];
|
||||
_ruleTextView.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_ruleTextView.font = [UIFont systemFontOfSize:12];
|
||||
_ruleTextView.scrollEnabled = NO;
|
||||
_ruleTextView.editable = NO;
|
||||
_ruleTextView.text = @"1)只有牌照房房主和超管才可以发起跨房pk,一次只能选择一个牌照房发起;\n2)只有房主和超管才可以接受或拒绝跨房pk请求,若10秒内不点击pk邀请弹窗,弹窗消失,视为自动拒绝;\n3)发起pk时需选择pk时间和pk对象,自定义时间下限为5,上限为180,只能填写整数;\n4)pk发起后,未到pk时间无法自行结束,若有特殊情况需提前结束可联系客服,但本场pk不算胜负。\n";
|
||||
_ruleTextView.text = @"";
|
||||
}
|
||||
return _ruleTextView;
|
||||
}
|
||||
- (UITextView *)secondTextView {
|
||||
if (!_secondTextView) {
|
||||
_secondTextView = [[UITextView alloc] init];
|
||||
_secondTextView.textColor = UIColorFromRGB(0xffffff);
|
||||
_secondTextView.backgroundColor = [UIColor clearColor];
|
||||
_secondTextView.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium];
|
||||
_secondTextView.scrollEnabled = NO;
|
||||
_secondTextView.editable = NO;
|
||||
_secondTextView.text = @"1)只有牌照房房主和超管才可以发起跨房pk,一次只能选择一个牌照房发起;\n2)只有房主和超管才可以接受或拒绝跨房pk请求,若10秒内不点击pk邀请弹窗,弹窗消失,视为自动拒绝;\n3)发起pk时需选择pk时间和pk对象,自定义时间下限为5,上限为180,只能填写整数;\n4)pk发起后,未到pk时间无法自行结束,若有特殊情况需提前结束可联系客服,但本场pk不算胜负。\n";
|
||||
|
||||
- (UIButton *)closeBtn {
|
||||
if (!_closeBtn) {
|
||||
_closeBtn = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||
[_closeBtn addTarget:self action:@selector(onCloseBtnClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
[_closeBtn setBackgroundImage:[UIImage imageNamed:@"anchorPk_result_close"] forState:UIControlStateNormal];
|
||||
}
|
||||
return _secondTextView;
|
||||
return _closeBtn;
|
||||
}
|
||||
|
||||
@end
|
||||
|
@@ -14,6 +14,9 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
///展示用户卡片
|
||||
- (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view showUserCard:(NSString *)uid;
|
||||
|
||||
///去房间
|
||||
- (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view onlookRoom:(NSString *)roomUid;
|
||||
|
||||
@end
|
||||
|
||||
@interface XPAnchorPkPanelView : UIView
|
||||
|
@@ -16,6 +16,9 @@
|
||||
#import "UIImage+Utils.h"
|
||||
#import "UIButton+EnlargeTouchArea.h"
|
||||
#import "Timestamp.h"
|
||||
#import "Api+UserCard.h"
|
||||
#import "XCHUDTool.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
///Model
|
||||
#import "UserInfoModel.h"
|
||||
#import "AcrossRoomPKPanelModel.h"
|
||||
@@ -61,10 +64,18 @@
|
||||
@property (nonatomic,strong) UIStackView *blueContributeStackView;
|
||||
///倒计时
|
||||
@property (strong, nonatomic) dispatch_source_t timer;
|
||||
///红方PK结果
|
||||
@property (nonatomic, strong) UIImageView *redResultImageView;
|
||||
///对方头像
|
||||
@property (nonatomic, strong) NetImageView *otherAvatarImageView;
|
||||
///对方PK结果
|
||||
@property (nonatomic, strong) UIImageView *otherResultImageView;
|
||||
///红方昵称容器
|
||||
@property (nonatomic, strong) UIStackView *redNickStackView;
|
||||
///红方昵称
|
||||
@property (nonatomic, strong) UILabel *redNickLabel;
|
||||
///关注按钮
|
||||
@property (nonatomic, strong) UIButton *attentionButton;
|
||||
///对方昵称容器
|
||||
@property (nonatomic, strong) UIStackView *otherStackView;
|
||||
///对方昵称
|
||||
@@ -72,6 +83,9 @@
|
||||
///跟随按钮
|
||||
@property (nonatomic, strong) UIButton *followButton;
|
||||
|
||||
///是否第一次展示
|
||||
@property (nonatomic, assign) BOOL isHadShow;
|
||||
|
||||
@end
|
||||
|
||||
@implementation XPAnchorPkPanelView
|
||||
@@ -99,9 +113,13 @@
|
||||
self.pkPanelInfo = nil;
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
|
||||
UIView *view = [super hitTest:point withEvent:event];
|
||||
return view == self?nil:view;
|
||||
}
|
||||
|
||||
#pragma mark - Private Method
|
||||
- (void)initSubViews {
|
||||
self.userInteractionEnabled = NO;
|
||||
[self addSubview:self.backImageView];
|
||||
[self.backImageView addSubview:self.stackView];
|
||||
[self.stackView addArrangedSubview:self.pkStateLabel];
|
||||
@@ -120,8 +138,12 @@
|
||||
[self.backImageView addSubview:self.redStarImageView];
|
||||
[self.backImageView addSubview:self.blueStarImageView];
|
||||
|
||||
[self addSubview:self.redResultImageView];
|
||||
[self addSubview:self.otherAvatarImageView];
|
||||
[self addSubview:self.otherResultImageView];
|
||||
[self addSubview:self.redNickStackView];
|
||||
[self.redNickStackView addArrangedSubview:self.redNickLabel];
|
||||
[self.redNickStackView addArrangedSubview:self.attentionButton];
|
||||
[self addSubview:self.otherStackView];
|
||||
[self.otherStackView addArrangedSubview:self.otherNickLabel];
|
||||
[self.otherStackView addArrangedSubview:self.followButton];
|
||||
@@ -239,11 +261,18 @@
|
||||
make.bottom.mas_equalTo(self.redContributeStackView);
|
||||
}];
|
||||
|
||||
[self.redResultImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo((KScreenWidth - 64) * 0.5 - 26 - 85 * 0.5 - 66 * 0.5);
|
||||
make.bottom.mas_equalTo(self.otherResultImageView);
|
||||
make.width.mas_equalTo(66);
|
||||
make.height.mas_equalTo(48);
|
||||
}];
|
||||
|
||||
///对方信息
|
||||
[self.otherAvatarImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.mas_equalTo(self.mas_centerX).mas_offset(58);
|
||||
make.left.mas_equalTo((KScreenWidth + 64) * 0.5 + 26 - 2.5);
|
||||
make.top.mas_equalTo(87);
|
||||
make.width.height.mas_equalTo(90 * kScreenScale);
|
||||
make.width.height.mas_equalTo(90);
|
||||
}];
|
||||
[self.otherResultImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.otherAvatarImageView);
|
||||
@@ -251,6 +280,15 @@
|
||||
make.width.mas_equalTo(66);
|
||||
make.height.mas_equalTo(48);
|
||||
}];
|
||||
[self.redNickStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.otherStackView);
|
||||
make.centerX.mas_equalTo(self.redResultImageView);
|
||||
make.height.mas_equalTo(20);
|
||||
}];
|
||||
[self.attentionButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(50, 20));
|
||||
}];
|
||||
|
||||
[self.otherStackView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.top.mas_equalTo(self.otherAvatarImageView.mas_bottom).mas_offset(17);
|
||||
make.centerX.mas_equalTo(self.otherAvatarImageView);
|
||||
@@ -321,15 +359,52 @@
|
||||
}
|
||||
|
||||
- (void)onFollowButtonClick:(UIButton *)button {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAnchorPKPanelView:onlookRoom:)]) {
|
||||
[self.delegate xPAnchorPKPanelView:self onlookRoom:self.pkPanelInfo.aUid];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)onAttentionButtonClick:(UIButton *)button {
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
NSString * ticket = [[AccountInfoStorage instance] getTicket];
|
||||
[Api attentionCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
self.attentionButton.hidden = YES;
|
||||
[XCHUDTool showErrorWithMessage:@"关注成功"];
|
||||
} else {
|
||||
[XCHUDTool showErrorWithMessage:msg];
|
||||
}
|
||||
} uid:uid likedUid:self.pkPanelInfo.cUid ticket:ticket type:@"1"];
|
||||
}
|
||||
|
||||
- (void)onShowUserCard:(UITapGestureRecognizer *)ges {
|
||||
if (self.delegate && [self.delegate respondsToSelector:@selector(xPAnchorPKPanelView:showUserCard:)]) {
|
||||
[self.delegate xPAnchorPKPanelView:self showUserCard:self.pkPanelInfo.aUid];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getters and setters
|
||||
- (void)setPkPanelInfo:(AcrossRoomPKPanelModel *)pkPanelInfo {
|
||||
_pkPanelInfo = pkPanelInfo;
|
||||
if (_pkPanelInfo) {
|
||||
if (!self.isHadShow) {
|
||||
self.isHadShow = YES;
|
||||
NSString * uid = [[AccountInfoStorage instance] getUid];
|
||||
if ([uid isEqualToString:pkPanelInfo.cUid]) {
|
||||
self.attentionButton.hidden = YES;
|
||||
} else if(pkPanelInfo.cUid){
|
||||
[Api attentionStatusCompletion:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
BOOL isLike = ((NSNumber *)data.data).boolValue;
|
||||
self.attentionButton.hidden = isLike;
|
||||
} uid:uid isLikeUid:pkPanelInfo.cUid];
|
||||
}
|
||||
}
|
||||
if (pkPanelInfo.pkState == AcrossRoomPkStateTypePenalty) {
|
||||
self.pkStateLabel.text = @"惩罚时间";
|
||||
if (self.timer) {
|
||||
dispatch_source_cancel(self.timer);
|
||||
self.timer = nil;
|
||||
}
|
||||
[Timestamp getInternetDateWithSuccess:^(NSTimeInterval timeInterval) {
|
||||
timeInterval = timeInterval * 1000;
|
||||
long aTime = (pkPanelInfo.penaltyEndTime - timeInterval) / 1000;
|
||||
@@ -340,7 +415,21 @@
|
||||
long aTime = (pkPanelInfo.penaltyEndTime - time2) / 1000;
|
||||
[self openCountdownWithTime:aTime];
|
||||
}];
|
||||
self.redResultImageView.hidden = NO;
|
||||
self.otherResultImageView.hidden = NO;
|
||||
if ([pkPanelInfo.winUid isEqualToString:pkPanelInfo.cUid]) {
|
||||
self.redResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_win"];
|
||||
self.otherResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_fail"];
|
||||
} else if ([pkPanelInfo.winUid isEqualToString:pkPanelInfo.aUid]) {//输
|
||||
self.redResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_fail"];
|
||||
self.otherResultImageView.image = [UIImage imageNamed:@""];
|
||||
} else {//平局
|
||||
self.redResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_tie"];
|
||||
self.otherResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_tie"];
|
||||
}
|
||||
} else {
|
||||
self.redResultImageView.hidden = YES;
|
||||
self.otherResultImageView.hidden = YES;
|
||||
self.pkStateLabel.text = @"PK";
|
||||
[Timestamp getInternetDateWithSuccess:^(NSTimeInterval timeInterval) {
|
||||
timeInterval = timeInterval * 1000;
|
||||
@@ -390,6 +479,7 @@
|
||||
}];
|
||||
self.otherAvatarImageView.imageUrl = pkPanelInfo.aAvatar;
|
||||
self.otherNickLabel.text = pkPanelInfo.aTitle;
|
||||
self.redNickLabel.text = pkPanelInfo.cTitle;
|
||||
} else {
|
||||
self.redCountLabel.text = @"0";
|
||||
self.blueCountLabel.text = @"0";
|
||||
@@ -540,6 +630,15 @@
|
||||
return _blueContributeStackView;
|
||||
}
|
||||
|
||||
- (UIImageView *)redResultImageView {
|
||||
if (!_redResultImageView) {
|
||||
_redResultImageView = [[UIImageView alloc] init];
|
||||
_redResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_win"];
|
||||
_redResultImageView.hidden = YES;
|
||||
}
|
||||
return _redResultImageView;
|
||||
}
|
||||
|
||||
- (NetImageView *)otherAvatarImageView {
|
||||
if (!_otherAvatarImageView) {
|
||||
NetImageConfig * config = [[NetImageConfig alloc]init];
|
||||
@@ -547,7 +646,10 @@
|
||||
config.placeHolder = [UIImageConstant defaultAvatarPlaceholder];
|
||||
_otherAvatarImageView = [[NetImageView alloc] initWithConfig:config];
|
||||
_otherAvatarImageView.layer.masksToBounds = YES;
|
||||
_otherAvatarImageView.layer.cornerRadius = 90 * kScreenScale / 2;
|
||||
_otherAvatarImageView.layer.cornerRadius = 90 / 2;
|
||||
_otherAvatarImageView.userInteractionEnabled = YES;
|
||||
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onShowUserCard:)];
|
||||
[_otherAvatarImageView addGestureRecognizer:tap];
|
||||
}
|
||||
return _otherAvatarImageView;
|
||||
}
|
||||
@@ -556,10 +658,43 @@
|
||||
if (!_otherResultImageView) {
|
||||
_otherResultImageView = [[UIImageView alloc] init];
|
||||
_otherResultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_win"];
|
||||
_otherResultImageView.hidden = YES;
|
||||
}
|
||||
return _otherResultImageView;
|
||||
}
|
||||
|
||||
- (UIStackView *)redNickStackView {
|
||||
if (!_redNickStackView) {
|
||||
_redNickStackView = [[UIStackView alloc] init];
|
||||
_redNickStackView.axis = UILayoutConstraintAxisHorizontal;
|
||||
_redNickStackView.distribution = UIStackViewDistributionFill;
|
||||
_redNickStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_redNickStackView.spacing = 2;
|
||||
_redNickStackView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _redNickStackView;
|
||||
}
|
||||
|
||||
- (UILabel *)redNickLabel {
|
||||
if (!_redNickLabel) {
|
||||
_redNickLabel = [[UILabel alloc] init];
|
||||
_redNickLabel.font = [UIFont systemFontOfSize:12];
|
||||
_redNickLabel.textColor = [UIColor whiteColor];
|
||||
_redNickLabel.textAlignment = NSTextAlignmentCenter;
|
||||
}
|
||||
return _redNickLabel;
|
||||
}
|
||||
|
||||
- (UIButton *)attentionButton {
|
||||
if (!_attentionButton) {
|
||||
_attentionButton = [[UIButton alloc] init];
|
||||
[_attentionButton setImage:[UIImage imageNamed:@"anchorPk_micro_attention"] forState:UIControlStateNormal];
|
||||
[_attentionButton addTarget:self action:@selector(onAttentionButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_attentionButton.hidden = YES;
|
||||
}
|
||||
return _attentionButton;
|
||||
}
|
||||
|
||||
- (UIStackView *)otherStackView {
|
||||
if (!_otherStackView) {
|
||||
_otherStackView = [[UIStackView alloc] init];
|
||||
@@ -567,6 +702,7 @@
|
||||
_otherStackView.distribution = UIStackViewDistributionFill;
|
||||
_otherStackView.alignment = UIStackViewAlignmentCenter;
|
||||
_otherStackView.spacing = 2;
|
||||
_otherStackView.userInteractionEnabled = YES;
|
||||
}
|
||||
return _otherStackView;
|
||||
}
|
||||
@@ -586,6 +722,7 @@
|
||||
_followButton = [[UIButton alloc] init];
|
||||
[_followButton setImage:[UIImage imageNamed:@"anchorPk_micro_follow"] forState:UIControlStateNormal];
|
||||
[_followButton addTarget:self action:@selector(onFollowButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_followButton.userInteractionEnabled = YES;
|
||||
}
|
||||
return _followButton;
|
||||
}
|
||||
|
@@ -50,7 +50,6 @@
|
||||
#import "XPAcrossRoomPKResultView.h"
|
||||
#import "XPAcrossRoomPKForceEndResultView.h"
|
||||
#import "XPAnchorPKInviteView.h"
|
||||
#import "XPAnchorPKRuleView.h"
|
||||
#import "XPAnchorPKResultView.h"
|
||||
#import "XPAnchorPKFinishView.h"
|
||||
#import "XPSendGiftView.h"
|
||||
@@ -58,7 +57,6 @@
|
||||
#import "XPRoomViewController.h"
|
||||
#import "XPLittleGameMiniStageView.h"
|
||||
#import "XPLittleGameRoomListView.h"
|
||||
#import "XPAcrossRoomPKPrizeView.h"
|
||||
#import "AcrossRoomPKPrizeModel.h"
|
||||
///个播PK
|
||||
#import "XPAnchorFansTeamEntranceView.h"
|
||||
@@ -332,6 +330,8 @@
|
||||
if (code == 200) {
|
||||
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:data.data];
|
||||
self.delegate.getRoomInfo.roundId = acrossPKPanelInfo.roundId;
|
||||
self.delegate.getRoomInfo.pkUid = acrossPKPanelInfo.aUid;
|
||||
self.delegate.getRoomInfo.pkRoomId = acrossPKPanelInfo.aRoomId;
|
||||
if (acrossPKPanelInfo.pkType == AcrossRoomPkTypeAnchor) {
|
||||
if (acrossPKPanelInfo.aUid.integerValue > 0) {
|
||||
if (!self.anchorPKPanelView.superview) {
|
||||
@@ -545,11 +545,8 @@
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[inviteResutView removeFromSuperview];
|
||||
});
|
||||
NSNumber *aRoomId = (NSNumber *)attachment.data[@"aRoomId"];
|
||||
NSNumber *aUid = (NSNumber *)attachment.data[@"aUid"];
|
||||
NSString *otherRoomId = [NSString stringWithFormat:@"%@", aRoomId];
|
||||
NSString *otherUid =[NSString stringWithFormat:@"%@", aUid];
|
||||
[[RtcManager instance] connectOtherRoom:otherRoomId userId:otherUid];
|
||||
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
||||
[[RtcManager instance] connectOtherRoom:acrossPKPanelInfo.aRoomId userId:acrossPKPanelInfo.aUid];
|
||||
}
|
||||
}
|
||||
}];
|
||||
@@ -615,7 +612,9 @@
|
||||
[self.anchorPKPanelView removeFromSuperview];
|
||||
self.anchorPKPanelView = nil;
|
||||
[[RtcManager instance] disconnectOtherRoom];
|
||||
AcrossRoomPKPanelModel * acrossPKPanelInfo = [AcrossRoomPKPanelModel modelWithJSON:attachment.data];
|
||||
XPAnchorPKFinishView *view = [[XPAnchorPKFinishView alloc] init];
|
||||
view.data = acrossPKPanelInfo;
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
break;
|
||||
@@ -748,6 +747,15 @@
|
||||
[self.delegate.getCurrentNav presentViewController:userCardVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
///去房间
|
||||
- (void)xPAnchorPKPanelView:(XPAnchorPkPanelView *)view onlookRoom:(NSString *)roomUid {
|
||||
[self.delegate exitRoom];
|
||||
///这个为啥加个延迟的 因为会先退房 有一个dismiss的动画 所以加个延迟吧
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
[XPRoomViewController openRoom:roomUid viewController:[XCCurrentVCStackManager shareManager].getCurrentVC];
|
||||
});
|
||||
}
|
||||
|
||||
#pragma mark - Event Response
|
||||
- (void)contributionButtonAction:(UIButton *)sender {
|
||||
NSString * roomUid = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.uid];
|
||||
@@ -863,7 +871,11 @@
|
||||
}
|
||||
|
||||
- (void)updateRoomTopic {
|
||||
if (self.delegate.getRoomInfo.type == RoomType_Anchor && self.delegate.getRoomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
self.topicStackView.hidden = YES;
|
||||
} else {
|
||||
self.topicStackView.hidden = ([ClientConfig shareConfig].configInfo.appStoreAuditNoticeVersion || self.delegate.getRoomInfo.type == RoomType_MiniGame) == YES;
|
||||
}
|
||||
[self updateRoomTopicViewConstraint];
|
||||
NIMChatroomMembersByIdsRequest *request = [[NIMChatroomMembersByIdsRequest alloc]init];
|
||||
request.roomId = [NSString stringWithFormat:@"%ld", self.delegate.getRoomInfo.roomId];
|
||||
|
@@ -49,7 +49,7 @@
|
||||
|
||||
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.imageName = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"room_more_menu_anchorPK_close" : @"room_more_menu_anchorPK_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];
|
||||
|
||||
|
@@ -16,6 +16,8 @@
|
||||
#import "XCHUDTool.h"
|
||||
#import "Api.h"
|
||||
#import "NetImageView.h"
|
||||
#import "Api+Room.h"
|
||||
#import "RtcManager.h"
|
||||
///Model
|
||||
#import "RoomInfoModel.h"
|
||||
#import "MicroExtModel.h"
|
||||
@@ -23,9 +25,10 @@
|
||||
///View
|
||||
#import "AnchorPKMicroView.h"
|
||||
#import "XPUserCardViewController.h"
|
||||
#import "XPAnchorPKRuleView.h"
|
||||
|
||||
// 房主头像宽 58 + 光圈 5
|
||||
#define ownerWidth (90 + 5) * kScreenScale
|
||||
#define ownerWidth (85 + 5)
|
||||
// 昵称高 12,距离头像间距 6
|
||||
#define ownerHeight (ownerWidth + 6 + 12)
|
||||
// 下面 8 个坑位宽50 + 光圈 5
|
||||
@@ -47,15 +50,12 @@
|
||||
///房主头像距上边距离
|
||||
#define topMargin 87
|
||||
|
||||
@interface AnchorPKStageView()
|
||||
@interface AnchorPKStageView()<RtcDelegate>
|
||||
|
||||
///vs图片
|
||||
@property (nonatomic, strong) UIImageView *vsImageView;
|
||||
|
||||
///规则按钮
|
||||
@property (nonatomic, strong) UIButton *ruleButton;
|
||||
///PK方头像
|
||||
@property (nonatomic, strong) NetImageView *otherMicroImageView;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
}
|
||||
|
||||
- (NSInteger)countOfMircoView {
|
||||
return 1;
|
||||
return 2;
|
||||
}
|
||||
|
||||
- (UIView<MicroViewProtocol> *)findMicroViewByIndex:(NSInteger)index {
|
||||
@@ -107,9 +107,9 @@
|
||||
*/
|
||||
- (CGRect)rectForViewAtIndex:(NSInteger)index {
|
||||
if (index == 0) {
|
||||
return CGRectMake((KScreenWidth - 64) * 0.5 - 26 - ownerWidth, topMargin, ownerWidth, ownerHeight);
|
||||
return CGRectMake((KScreenWidth - 64) * 0.5 - 26 - ownerWidth+2.5, topMargin, ownerWidth, ownerHeight);
|
||||
} else {
|
||||
return CGRectMake((KScreenWidth + 64) * 0.5 + 26, topMargin, ownerWidth, ownerHeight);
|
||||
return CGRectMake((KScreenWidth + 64) * 0.5 + 26 - 2.5, topMargin, ownerWidth, ownerHeight);
|
||||
}
|
||||
return [super rectForViewAtIndex:index];
|
||||
}
|
||||
@@ -138,6 +138,62 @@
|
||||
});
|
||||
}
|
||||
|
||||
- (void)handleNIMNotificationMessage:(NIMMessage *)message {
|
||||
[super handleNIMNotificationMessage:message];
|
||||
|
||||
NIMNotificationObject *notiMsg = (NIMNotificationObject *)message.messageObject;
|
||||
NIMChatroomNotificationContent *content = (NIMChatroomNotificationContent *)notiMsg.content;
|
||||
switch (content.eventType) {
|
||||
case NIMChatroomEventTypeInfoUpdated: // 麦序状态更新
|
||||
{
|
||||
NSDictionary *data = [content.notifyExt toJSONObject];
|
||||
int type = [data[@"type"] intValue];
|
||||
NSArray* microStates;
|
||||
switch (type) {
|
||||
case 2:
|
||||
microStates = @[[MicroStateModel modelWithJSON:data[@"micInfo"]]];
|
||||
break;
|
||||
case 3:
|
||||
microStates = [MicroStateModel modelsWithArray:data[@"micInfo"]];
|
||||
break;
|
||||
}
|
||||
BOOL selfNeedBroadcast = NO;
|
||||
if (microStates && microStates.count > 0) {
|
||||
for (MicroStateModel *microState in microStates) {
|
||||
MicroQueueModel *micSequence = [self.getMicroQueue objectForKey:[NSString stringWithFormat:@"%d", microState.position]];
|
||||
micSequence.microState = microState;
|
||||
if (micSequence.userInfo.uid == [AccountInfoStorage instance].getUid.integerValue && micSequence.microState.micState == MicroMicStateType_Open) {
|
||||
selfNeedBroadcast = YES;
|
||||
}
|
||||
}
|
||||
if (selfNeedBroadcast) {
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{//延迟1s,等待rtc角色变为主播才可发起跨房通话
|
||||
[[RtcManager instance] connectOtherRoom:self.hostDelegate.getRoomInfo.pkRoomId userId:self.hostDelegate.getRoomInfo.pkUid];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NIMChatroomEventTypeQueueChange: // 麦序上下麦
|
||||
{
|
||||
NSDictionary* data = (NSDictionary *)content.ext;
|
||||
UserInfoModel* userInfo = [UserInfoModel modelWithJSON:[data objectForKey:NIMChatroomEventInfoQueueChangeItemValueKey]];
|
||||
NSInteger changeType = [data[NIMChatroomEventInfoQueueChangeTypeKey] integerValue];
|
||||
|
||||
if (changeType == 1) { // 上麦
|
||||
if (userInfo.uid == [AccountInfoStorage instance].getUid.integerValue) {///房主上麦
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{//延迟1s,等待rtc角色变为主播才可发起跨房通话
|
||||
[[RtcManager instance] connectOtherRoom:self.hostDelegate.getRoomInfo.pkRoomId userId:self.hostDelegate.getRoomInfo.pkUid];
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)autoUpMicAtIndex:(NSInteger)index {
|
||||
NIMChatroomQueueUpdateRequest *request = [[NIMChatroomQueueUpdateRequest alloc]init];
|
||||
request.key = [NSString stringWithFormat:@"%zd", index];
|
||||
@@ -221,7 +277,37 @@
|
||||
|
||||
#pragma mark - event
|
||||
- (void)onRuleButtonClick:(UIButton *)button {
|
||||
[Api requestAnchorPkRule:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) {
|
||||
if (code == 200) {
|
||||
XPAnchorPKRuleView *view = [[XPAnchorPKRuleView alloc] init];
|
||||
view.ruleString = data.data;
|
||||
[TTPopup popupView:view style:TTPopupStyleAlert];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - RtcDelegate - 讲话的波纹回调
|
||||
- (void)usersSpeaking:(NSMutableArray *)uids {
|
||||
if ([RtcManager instance].isRemoteMuted) {
|
||||
return;
|
||||
}
|
||||
for (NSString* uid in uids) {
|
||||
if ([RtcManager instance].isLocalMuted && uid.integerValue == self.hostDelegate.getUserInfo.uid) {
|
||||
continue;
|
||||
}
|
||||
UIView<MicroViewProtocol>* microView = [self findMicroViewByUid:uid];
|
||||
if (microView) {
|
||||
[microView userSpeaking];
|
||||
} else {
|
||||
RoomInfoModel *roomInfo = self.hostDelegate.getRoomInfo;
|
||||
if ([uid isEqualToString:roomInfo.pkUid]) {
|
||||
UIView<MicroViewProtocol>* microView = [self findMicroViewByIndex:1];
|
||||
if (microView) {
|
||||
[microView userSpeaking];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - getter
|
||||
|
@@ -9,16 +9,9 @@
|
||||
|
||||
///Third
|
||||
#import <Masonry/Masonry.h>
|
||||
///Tool
|
||||
#import "NetImageView.h"
|
||||
#import "AccountInfoStorage.h"
|
||||
|
||||
@interface AnchorPKMicroView ()
|
||||
|
||||
///关注、跟随按钮
|
||||
@property (nonatomic,strong) UIButton *followButton;
|
||||
///结果图片
|
||||
@property (nonatomic, strong) UIImageView *resultImageView;
|
||||
///当前坑位
|
||||
@property (nonatomic, assign) NSInteger position;
|
||||
|
||||
@@ -28,21 +21,10 @@
|
||||
|
||||
- (void)initSubViews {
|
||||
[super initSubViews];
|
||||
[self.stackView addArrangedSubview:self.followButton];
|
||||
[self addSubview:self.resultImageView];
|
||||
}
|
||||
|
||||
- (void)initSubViewConstraints {
|
||||
[super initSubViewConstraints];
|
||||
[self.followButton mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.size.mas_equalTo(CGSizeMake(50, 20));
|
||||
}];
|
||||
[self.resultImageView mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.centerX.mas_equalTo(self.avatarImageView);
|
||||
make.bottom.mas_equalTo(self.avatarImageView).mas_offset(12);
|
||||
make.width.mas_equalTo(66);
|
||||
make.height.mas_equalTo(48);
|
||||
}];
|
||||
}
|
||||
|
||||
#pragma mark - MicroViewProtocol
|
||||
@@ -58,14 +40,15 @@
|
||||
[super configMicroView:model];
|
||||
RoomInfoModel * roomInfo = self.getRoomInfo;
|
||||
UserInfoModel * userInfo = model.userInfo;
|
||||
NSMutableDictionary * micQueue = [self getMicroQueue];
|
||||
|
||||
int position = model.microState.position;
|
||||
self.position = position;
|
||||
if (position != -1 && userInfo == nil) {
|
||||
self.nickLabel.text = @"";
|
||||
}
|
||||
self.nickLabel.hidden = NO;
|
||||
if (roomInfo.type == RoomType_Anchor && roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode) {
|
||||
self.stackView.hidden = YES;
|
||||
}
|
||||
self.nickLabel.hidden = YES;
|
||||
self.postionLabel.hidden = YES;
|
||||
|
||||
NSString *nickStr = userInfo.nick;
|
||||
@@ -106,26 +89,4 @@
|
||||
self.sexImageView.hidden = YES;
|
||||
}
|
||||
|
||||
#pragma mark - event
|
||||
- (void)onFollowButtonClick:(UIButton *)button {
|
||||
|
||||
}
|
||||
|
||||
- (UIButton *)followButton {
|
||||
if (!_followButton) {
|
||||
_followButton = [[UIButton alloc] init];
|
||||
[_followButton setImage:[UIImage imageNamed:@"anchorPk_micro_attention"] forState:UIControlStateNormal];
|
||||
[_followButton addTarget:self action:@selector(onFollowButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
||||
}
|
||||
return _followButton;
|
||||
}
|
||||
|
||||
- (UIImageView *)resultImageView {
|
||||
if (!_resultImageView) {
|
||||
_resultImageView = [[UIImageView alloc] init];
|
||||
_resultImageView.image = [UIImage imageNamed:@"anchorPk_micro_result_win"];
|
||||
}
|
||||
return _resultImageView;
|
||||
}
|
||||
|
||||
@end
|
||||
|